VERSION 5.00
Object = "{3B7C8863-D78F-101B-B9B5-04021C009402}#1.2#0"; "richtx32.ocx"
Object = "{248DD890-BB45-11CF-9ABC-0080C7E7B78D}#1.0#0"; "mswinsck.ocx"
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "mscomctl.ocx"
Begin VB.Form frmGH 
   AutoRedraw      =   -1  'True
   Caption         =   "GH"
   ClientHeight    =   5055
   ClientLeft      =   165
   ClientTop       =   750
   ClientWidth     =   9300
   DrawStyle       =   5  'Transparent
   FillColor       =   &H80000012&
   BeginProperty Font 
      Name            =   "Microsoft Sans Serif"
      Size            =   8.25
      Charset         =   0
      Weight          =   400
      Underline       =   0   'False
      Italic          =   0   'False
      Strikethrough   =   0   'False
   EndProperty
   Icon            =   "frmGH.frx":0000
   KeyPreview      =   -1  'True
   LinkTopic       =   "Form1"
   ScaleHeight     =   5055
   ScaleWidth      =   9300
   Begin VB.CommandButton cmdGTA2Manager 
      Caption         =   "&Manager"
      Height          =   375
      Left            =   5280
      TabIndex        =   17
      Top             =   0
      Width           =   1215
   End
   Begin VB.CommandButton cmdX 
      Caption         =   "X"
      Enabled         =   0   'False
      Height          =   210
      Left            =   7800
      TabIndex        =   15
      Top             =   3480
      Width           =   375
   End
   Begin VB.PictureBox picTray 
      BeginProperty Font 
         Name            =   "Arial"
         Size            =   8.25
         Charset         =   238
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   300
      Left            =   3960
      ScaleHeight     =   240
      ScaleWidth      =   240
      TabIndex        =   9
      TabStop         =   0   'False
      Top             =   4320
      Visible         =   0   'False
      Width           =   300
   End
   Begin VB.PictureBox picHead 
      BeginProperty Font 
         Name            =   "Arial"
         Size            =   8.25
         Charset         =   238
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   375
      Left            =   4440
      Picture         =   "frmGH.frx":37C2
      ScaleHeight     =   315
      ScaleWidth      =   315
      TabIndex        =   14
      TabStop         =   0   'False
      Top             =   4320
      Visible         =   0   'False
      Width           =   375
   End
   Begin VB.CommandButton cmdCancel 
      Caption         =   "Cancel &Download"
      Height          =   360
      Left            =   7440
      TabIndex        =   13
      Top             =   0
      Visible         =   0   'False
      Width           =   1575
   End
   Begin VB.TextBox txtNoGames 
      BorderStyle     =   0  'None
      Height          =   300
      Left            =   60
      Locked          =   -1  'True
      TabIndex        =   12
      TabStop         =   0   'False
      Text            =   "Created games will be shown here"
      Top             =   720
      Visible         =   0   'False
      Width           =   2652
   End
   Begin MSWinsockLib.Winsock sckURL 
      Left            =   1200
      Top             =   3960
      _ExtentX        =   741
      _ExtentY        =   741
      _Version        =   393216
      RemotePort      =   80
   End
   Begin MSComctlLib.ListView lvMMPlist 
      Height          =   255
      Left            =   6360
      TabIndex        =   10
      TabStop         =   0   'False
      Top             =   4440
      Visible         =   0   'False
      Width           =   975
      _ExtentX        =   1720
      _ExtentY        =   450
      View            =   3
      Sorted          =   -1  'True
      LabelWrap       =   -1  'True
      HideSelection   =   0   'False
      PictureAlignment=   4
      _Version        =   393217
      ForeColor       =   -2147483640
      BackColor       =   -2147483643
      BorderStyle     =   1
      Appearance      =   0
      MousePointer    =   1
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "Microsoft Sans Serif"
         Size            =   8.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      NumItems        =   0
   End
   Begin RichTextLib.RichTextBox rtbTopic 
      Height          =   375
      Index           =   0
      Left            =   0
      TabIndex        =   6
      TabStop         =   0   'False
      Tag             =   "#gta2gh"
      Top             =   1080
      Width           =   5535
      _ExtentX        =   9763
      _ExtentY        =   661
      _Version        =   393217
      BorderStyle     =   0
      Enabled         =   -1  'True
      MultiLine       =   0   'False
      TextRTF         =   $"frmGH.frx":3D60
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "Microsoft Sans Serif"
         Size            =   8.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
   End
   Begin MSComctlLib.TabStrip tabIRC 
      Height          =   360
      Left            =   0
      TabIndex        =   11
      TabStop         =   0   'False
      Top             =   3480
      Width           =   5535
      _ExtentX        =   9763
      _ExtentY        =   635
      Placement       =   1
      TabMinWidth     =   529
      ImageList       =   "imgList"
      _Version        =   393216
      BeginProperty Tabs {1EFB6598-857C-11D1-B16A-00C0F0283628} 
         NumTabs         =   1
         BeginProperty Tab1 {1EFB659A-857C-11D1-B16A-00C0F0283628} 
            Caption         =   "#gta2gh"
            ImageVarType    =   2
         EndProperty
      EndProperty
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "Microsoft Sans Serif"
         Size            =   8.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
   End
   Begin RichTextLib.RichTextBox rtbChatbox 
      Height          =   390
      Index           =   0
      Left            =   0
      TabIndex        =   4
      Tag             =   "#gta2gh"
      Top             =   2880
      Width           =   5535
      _ExtentX        =   9763
      _ExtentY        =   688
      _Version        =   393217
      BorderStyle     =   0
      Enabled         =   -1  'True
      MultiLine       =   0   'False
      TextRTF         =   $"frmGH.frx":3DEE
   End
   Begin VB.Timer timUpdateMap 
      Interval        =   2000
      Left            =   1200
      Top             =   4440
   End
   Begin RichTextLib.RichTextBox rtbHistory 
      Height          =   1455
      Index           =   0
      Left            =   0
      TabIndex        =   5
      Tag             =   "#gta2gh"
      Top             =   1440
      Width           =   5535
      _ExtentX        =   9763
      _ExtentY        =   2566
      _Version        =   393217
      BorderStyle     =   0
      ReadOnly        =   -1  'True
      ScrollBars      =   2
      DisableNoScroll =   -1  'True
      TextRTF         =   $"frmGH.frx":3E77
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "Arial"
         Size            =   9.75
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
   End
   Begin VB.CommandButton cmdOptions 
      Caption         =   "&Options"
      Height          =   360
      Left            =   2640
      TabIndex        =   2
      TabStop         =   0   'False
      Top             =   0
      Width           =   1215
   End
   Begin VB.CommandButton cmdConnect 
      Caption         =   "Sign &In"
      Height          =   360
      Left            =   0
      TabIndex        =   0
      TabStop         =   0   'False
      Top             =   0
      Width           =   1215
   End
   Begin MSWinsockLib.Winsock sockIRC 
      Left            =   720
      Top             =   4440
      _ExtentX        =   741
      _ExtentY        =   741
      _Version        =   393216
   End
   Begin VB.CommandButton cmdHost 
      Caption         =   "Create &Game"
      Height          =   360
      Left            =   1320
      TabIndex        =   1
      TabStop         =   0   'False
      Top             =   0
      Width           =   1215
   End
   Begin VB.CommandButton cmdDisconnect 
      Caption         =   "Sign &Out"
      Enabled         =   0   'False
      Height          =   360
      Left            =   3960
      TabIndex        =   3
      TabStop         =   0   'False
      Top             =   0
      Width           =   1215
   End
   Begin VB.Timer timerStatus 
      Interval        =   1000
      Left            =   120
      Top             =   4440
   End
   Begin VB.Timer timTimeout 
      Enabled         =   0   'False
      Interval        =   10000
      Left            =   1680
      Top             =   4440
   End
   Begin MSComctlLib.ListView lvPlayers 
      Height          =   2895
      Index           =   0
      Left            =   5520
      TabIndex        =   7
      TabStop         =   0   'False
      Tag             =   "#gta2gh"
      Top             =   360
      Width           =   2535
      _ExtentX        =   4471
      _ExtentY        =   5106
      View            =   3
      LabelEdit       =   1
      Sorted          =   -1  'True
      LabelWrap       =   -1  'True
      HideSelection   =   0   'False
      FullRowSelect   =   -1  'True
      GridLines       =   -1  'True
      PictureAlignment=   4
      _Version        =   393217
      Icons           =   "ImageList1"
      SmallIcons      =   "ImageList1"
      ColHdrIcons     =   "ImageListSortIconIndicator"
      ForeColor       =   -2147483640
      BackColor       =   -2147483643
      Appearance      =   1
      MousePointer    =   1
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "Microsoft Sans Serif"
         Size            =   8.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      NumItems        =   3
      BeginProperty ColumnHeader(1) {BDD1F052-858B-11D1-B16A-00C0F0283628} 
         Object.Tag             =   "STRING"
         Text            =   "Players (0)"
         Object.Width           =   2540
      EndProperty
      BeginProperty ColumnHeader(2) {BDD1F052-858B-11D1-B16A-00C0F0283628} 
         SubItemIndex    =   1
         Object.Tag             =   "STRING"
         Text            =   "CC"
         Object.Width           =   688
      EndProperty
      BeginProperty ColumnHeader(3) {BDD1F052-858B-11D1-B16A-00C0F0283628} 
         SubItemIndex    =   2
         Object.Tag             =   "STRING"
         Text            =   "Status"
         Object.Width           =   1111
      EndProperty
   End
   Begin MSComctlLib.ImageList ImageListSortIconIndicator 
      Left            =   2280
      Top             =   4320
      _ExtentX        =   1005
      _ExtentY        =   1005
      BackColor       =   -2147483643
      ImageWidth      =   8
      ImageHeight     =   7
      MaskColor       =   12632256
      _Version        =   393216
      BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628} 
         NumListImages   =   2
         BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmGH.frx":3EEE
            Key             =   ""
         EndProperty
         BeginProperty ListImage2 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmGH.frx":3FC0
            Key             =   ""
         EndProperty
      EndProperty
   End
   Begin MSComctlLib.ImageList ImageList1 
      Left            =   3000
      Top             =   4320
      _ExtentX        =   1005
      _ExtentY        =   1005
      BackColor       =   -2147483643
      ImageWidth      =   16
      ImageHeight     =   11
      MaskColor       =   12632256
      _Version        =   393216
      BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628} 
         NumListImages   =   253
         BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmGH.frx":4092
            Key             =   ""
         EndProperty
         BeginProperty ListImage2 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmGH.frx":4189
            Key             =   ""
         EndProperty
         BeginProperty ListImage3 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmGH.frx":4316
            Key             =   ""
         EndProperty
         BeginProperty ListImage4 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmGH.frx":449F
            Key             =   ""
         EndProperty
         BeginProperty ListImage5 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmGH.frx":462D
            Key             =   ""
         EndProperty
         BeginProperty ListImage6 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmGH.frx":47BB
            Key             =   ""
         EndProperty
         BeginProperty ListImage7 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmGH.frx":4944
            Key             =   ""
         EndProperty
         BeginProperty ListImage8 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmGH.frx":4AD3
            Key             =   ""
         EndProperty
         BeginProperty ListImage9 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmGH.frx":4BE3
            Key             =   ""
         EndProperty
         BeginProperty ListImage10 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmGH.frx":4D70
            Key             =   ""
         EndProperty
         BeginProperty ListImage11 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmGH.frx":4E67
            Key             =   ""
         EndProperty
         BeginProperty ListImage12 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmGH.frx":4FEC
            Key             =   ""
         EndProperty
         BeginProperty ListImage13 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmGH.frx":5176
            Key             =   ""
         EndProperty
         BeginProperty ListImage14 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmGH.frx":52FD
            Key             =   ""
         EndProperty
         BeginProperty ListImage15 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmGH.frx":5486
            Key             =   ""
         EndProperty
         BeginProperty ListImage16 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmGH.frx":561C
            Key             =   ""
         EndProperty
         BeginProperty ListImage17 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmGH.frx":57A1
            Key             =   ""
         EndProperty
         BeginProperty ListImage18 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmGH.frx":592F
            Key             =   ""
         EndProperty
         BeginProperty ListImage19 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmGH.frx":5AAA
            Key             =   ""
         EndProperty
         BeginProperty ListImage20 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmGH.frx":5C35
            Key             =   ""
         EndProperty
         BeginProperty ListImage21 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmGH.frx":5DC1
            Key             =   ""
         EndProperty
         BeginProperty ListImage22 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmGH.frx":5F46
            Key             =   ""
         EndProperty
         BeginProperty ListImage23 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmGH.frx":60CB
            Key             =   ""
         EndProperty
         BeginProperty ListImage24 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmGH.frx":624E
            Key             =   ""
         EndProperty
         BeginProperty ListImage25 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmGH.frx":63DA
            Key             =   ""
         EndProperty
         BeginProperty ListImage26 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmGH.frx":6566
            Key             =   ""
         EndProperty
         BeginProperty ListImage27 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmGH.frx":66F1
            Key             =   ""
         EndProperty
         BeginProperty ListImage28 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmGH.frx":686C
            Key             =   ""
         EndProperty
         BeginProperty ListImage29 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmGH.frx":6A01
            Key             =   ""
         EndProperty
         BeginProperty ListImage30 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmGH.frx":6B89
            Key             =   ""
         EndProperty
         BeginProperty ListImage31 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmGH.frx":6D0C
            Key             =   ""
         EndProperty
         BeginProperty ListImage32 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmGH.frx":6E93
            Key             =   ""
         EndProperty
         BeginProperty ListImage33 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmGH.frx":7027
            Key             =   ""
         EndProperty
         BeginProperty ListImage34 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmGH.frx":71B2
            Key             =   ""
         EndProperty
         BeginProperty ListImage35 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmGH.frx":7343
            Key             =   ""
         EndProperty
         BeginProperty ListImage36 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmGH.frx":74D4
            Key             =   ""
         EndProperty
         BeginProperty ListImage37 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmGH.frx":7658
            Key             =   ""
         EndProperty
         BeginProperty ListImage38 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmGH.frx":77DA
            Key             =   ""
         EndProperty
         BeginProperty ListImage39 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmGH.frx":796C
            Key             =   ""
         EndProperty
         BeginProperty ListImage40 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmGH.frx":7AF7
            Key             =   ""
         EndProperty
         BeginProperty ListImage41 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmGH.frx":7C84
            Key             =   ""
         EndProperty
         BeginProperty ListImage42 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmGH.frx":7E18
            Key             =   ""
         EndProperty
         BeginProperty ListImage43 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmGH.frx":7FA3
            Key             =   ""
         EndProperty
         BeginProperty ListImage44 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmGH.frx":8134
            Key             =   ""
         EndProperty
         BeginProperty ListImage45 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmGH.frx":82BC
            Key             =   ""
         EndProperty
         BeginProperty ListImage46 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmGH.frx":8448
            Key             =   ""
         EndProperty
         BeginProperty ListImage47 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmGH.frx":85D0
            Key             =   ""
         EndProperty
         BeginProperty ListImage48 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmGH.frx":875A
            Key             =   ""
         EndProperty
         BeginProperty ListImage49 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmGH.frx":88E1
            Key             =   ""
         EndProperty
         BeginProperty ListImage50 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmGH.frx":8A70
            Key             =   ""
         EndProperty
         BeginProperty ListImage51 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmGH.frx":8BED
            Key             =   ""
         EndProperty
         BeginProperty ListImage52 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmGH.frx":8D6F
            Key             =   ""
         EndProperty
         BeginProperty ListImage53 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmGH.frx":8EF2
            Key             =   ""
         EndProperty
         BeginProperty ListImage54 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmGH.frx":9001
            Key             =   ""
         EndProperty
         BeginProperty ListImage55 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmGH.frx":9187
            Key             =   ""
         EndProperty
         BeginProperty ListImage56 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmGH.frx":930A
            Key             =   ""
         EndProperty
         BeginProperty ListImage57 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmGH.frx":9496
            Key             =   ""
         EndProperty
         BeginProperty ListImage58 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmGH.frx":961E
            Key             =   ""
         EndProperty
         BeginProperty ListImage59 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmGH.frx":97A9
            Key             =   ""
         EndProperty
         BeginProperty ListImage60 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmGH.frx":9932
            Key             =   ""
         EndProperty
         BeginProperty ListImage61 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmGH.frx":9AB8
            Key             =   ""
         EndProperty
         BeginProperty ListImage62 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmGH.frx":9C40
            Key             =   ""
         EndProperty
         BeginProperty ListImage63 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmGH.frx":9DD2
            Key             =   ""
         EndProperty
         BeginProperty ListImage64 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmGH.frx":9F5F
            Key             =   ""
         EndProperty
         BeginProperty ListImage65 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmGH.frx":A0EB
            Key             =   ""
         EndProperty
         BeginProperty ListImage66 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmGH.frx":A271
            Key             =   ""
         EndProperty
         BeginProperty ListImage67 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmGH.frx":A3F7
            Key             =   ""
         EndProperty
         BeginProperty ListImage68 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmGH.frx":A57E
            Key             =   ""
         EndProperty
         BeginProperty ListImage69 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmGH.frx":A705
            Key             =   ""
         EndProperty
         BeginProperty ListImage70 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmGH.frx":A88A
            Key             =   ""
         EndProperty
         BeginProperty ListImage71 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmGH.frx":AA0F
            Key             =   ""
         EndProperty
         BeginProperty ListImage72 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmGH.frx":AB97
            Key             =   ""
         EndProperty
         BeginProperty ListImage73 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmGH.frx":AD1F
            Key             =   ""
            Object.Tag             =   "EU"
         EndProperty
         BeginProperty ListImage74 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmGH.frx":ADE6
            Key             =   ""
         EndProperty
         BeginProperty ListImage75 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmGH.frx":AF76
            Key             =   ""
         EndProperty
         BeginProperty ListImage76 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmGH.frx":B104
            Key             =   ""
         EndProperty
         BeginProperty ListImage77 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmGH.frx":B292
            Key             =   ""
         EndProperty
         BeginProperty ListImage78 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmGH.frx":B421
            Key             =   ""
         EndProperty
         BeginProperty ListImage79 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmGH.frx":B5AB
            Key             =   ""
         EndProperty
         BeginProperty ListImage80 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmGH.frx":B6A2
            Key             =   ""
         EndProperty
         BeginProperty ListImage81 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmGH.frx":B82C
            Key             =   ""
         EndProperty
         BeginProperty ListImage82 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmGH.frx":B9B6
            Key             =   ""
         EndProperty
         BeginProperty ListImage83 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmGH.frx":BB3F
            Key             =   ""
         EndProperty
         BeginProperty ListImage84 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmGH.frx":BCD9
            Key             =   ""
         EndProperty
         BeginProperty ListImage85 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmGH.frx":BE5C
            Key             =   ""
         EndProperty
         BeginProperty ListImage86 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmGH.frx":BFE2
            Key             =   ""
         EndProperty
         BeginProperty ListImage87 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmGH.frx":C179
            Key             =   ""
         EndProperty
         BeginProperty ListImage88 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmGH.frx":C2FF
            Key             =   ""
         EndProperty
         BeginProperty ListImage89 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmGH.frx":C481
            Key             =   ""
         EndProperty
         BeginProperty ListImage90 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmGH.frx":C60F
            Key             =   ""
         EndProperty
         BeginProperty ListImage91 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmGH.frx":C79B
            Key             =   ""
         EndProperty
         BeginProperty ListImage92 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmGH.frx":C927
            Key             =   ""
         EndProperty
         BeginProperty ListImage93 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmGH.frx":CAAF
            Key             =   ""
         EndProperty
         BeginProperty ListImage94 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmGH.frx":CC30
            Key             =   ""
         EndProperty
         BeginProperty ListImage95 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmGH.frx":CDBE
            Key             =   ""
         EndProperty
         BeginProperty ListImage96 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmGH.frx":CF50
            Key             =   ""
         EndProperty
         BeginProperty ListImage97 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmGH.frx":D0DA
            Key             =   ""
         EndProperty
         BeginProperty ListImage98 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmGH.frx":D261
            Key             =   ""
         EndProperty
         BeginProperty ListImage99 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmGH.frx":D3E3
            Key             =   ""
         EndProperty
         BeginProperty ListImage100 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmGH.frx":D56E
            Key             =   ""
         EndProperty
         BeginProperty ListImage101 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmGH.frx":D6F3
            Key             =   ""
         EndProperty
         BeginProperty ListImage102 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmGH.frx":D889
            Key             =   ""
         EndProperty
         BeginProperty ListImage103 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmGH.frx":DA14
            Key             =   ""
         EndProperty
         BeginProperty ListImage104 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmGH.frx":DBA5
            Key             =   ""
         EndProperty
         BeginProperty ListImage105 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmGH.frx":DD26
            Key             =   ""
         EndProperty
         BeginProperty ListImage106 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmGH.frx":DEB7
            Key             =   ""
         EndProperty
         BeginProperty ListImage107 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmGH.frx":E03E
            Key             =   ""
         EndProperty
         BeginProperty ListImage108 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmGH.frx":E1C4
            Key             =   ""
         EndProperty
         BeginProperty ListImage109 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmGH.frx":E34E
            Key             =   ""
         EndProperty
         BeginProperty ListImage110 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmGH.frx":E4D3
            Key             =   ""
         EndProperty
         BeginProperty ListImage111 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmGH.frx":E662
            Key             =   ""
         EndProperty
         BeginProperty ListImage112 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmGH.frx":E7EC
            Key             =   ""
         EndProperty
         BeginProperty ListImage113 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmGH.frx":E8E3
            Key             =   ""
         EndProperty
         BeginProperty ListImage114 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmGH.frx":EA6D
            Key             =   ""
         EndProperty
         BeginProperty ListImage115 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmGH.frx":EB64
            Key             =   ""
         EndProperty
         BeginProperty ListImage116 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmGH.frx":ECED
            Key             =   ""
         EndProperty
         BeginProperty ListImage117 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmGH.frx":EE77
            Key             =   ""
         EndProperty
         BeginProperty ListImage118 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmGH.frx":EFFB
            Key             =   ""
         EndProperty
         BeginProperty ListImage119 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmGH.frx":F18D
            Key             =   ""
         EndProperty
         BeginProperty ListImage120 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmGH.frx":F311
            Key             =   ""
         EndProperty
         BeginProperty ListImage121 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmGH.frx":F4A0
            Key             =   ""
         EndProperty
         BeginProperty ListImage122 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmGH.frx":F62A
            Key             =   ""
         EndProperty
         BeginProperty ListImage123 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmGH.frx":F7C7
            Key             =   ""
         EndProperty
         BeginProperty ListImage124 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmGH.frx":F94D
            Key             =   ""
         EndProperty
         BeginProperty ListImage125 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmGH.frx":FADE
            Key             =   ""
         EndProperty
         BeginProperty ListImage126 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmGH.frx":FC68
            Key             =   ""
         EndProperty
         BeginProperty ListImage127 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmGH.frx":FDEF
            Key             =   ""
         EndProperty
         BeginProperty ListImage128 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmGH.frx":FF79
            Key             =   ""
         EndProperty
         BeginProperty ListImage129 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmGH.frx":100FC
            Key             =   ""
         EndProperty
         BeginProperty ListImage130 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmGH.frx":10280
            Key             =   ""
         EndProperty
         BeginProperty ListImage131 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmGH.frx":10406
            Key             =   ""
         EndProperty
         BeginProperty ListImage132 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmGH.frx":10593
            Key             =   ""
         EndProperty
         BeginProperty ListImage133 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmGH.frx":10719
            Key             =   ""
         EndProperty
         BeginProperty ListImage134 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmGH.frx":108A5
            Key             =   ""
         EndProperty
         BeginProperty ListImage135 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmGH.frx":10A3B
            Key             =   ""
         EndProperty
         BeginProperty ListImage136 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmGH.frx":10BCB
            Key             =   ""
         EndProperty
         BeginProperty ListImage137 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmGH.frx":10D53
            Key             =   ""
         EndProperty
         BeginProperty ListImage138 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmGH.frx":10EE6
            Key             =   ""
         EndProperty
         BeginProperty ListImage139 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmGH.frx":11076
            Key             =   ""
         EndProperty
         BeginProperty ListImage140 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmGH.frx":111FD
            Key             =   ""
         EndProperty
         BeginProperty ListImage141 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmGH.frx":1138A
            Key             =   ""
         EndProperty
         BeginProperty ListImage142 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmGH.frx":11518
            Key             =   ""
         EndProperty
         BeginProperty ListImage143 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmGH.frx":116AF
            Key             =   ""
         EndProperty
         BeginProperty ListImage144 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmGH.frx":11844
            Key             =   ""
         EndProperty
         BeginProperty ListImage145 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmGH.frx":119C6
            Key             =   ""
         EndProperty
         BeginProperty ListImage146 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmGH.frx":11B60
            Key             =   ""
         EndProperty
         BeginProperty ListImage147 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmGH.frx":11CEA
            Key             =   ""
         EndProperty
         BeginProperty ListImage148 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmGH.frx":11E7F
            Key             =   ""
         EndProperty
         BeginProperty ListImage149 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmGH.frx":12002
            Key             =   ""
         EndProperty
         BeginProperty ListImage150 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmGH.frx":1218D
            Key             =   ""
         EndProperty
         BeginProperty ListImage151 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmGH.frx":12318
            Key             =   ""
         EndProperty
         BeginProperty ListImage152 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmGH.frx":124A4
            Key             =   ""
         EndProperty
         BeginProperty ListImage153 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmGH.frx":12870
            Key             =   ""
         EndProperty
         BeginProperty ListImage154 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmGH.frx":129FF
            Key             =   ""
         EndProperty
         BeginProperty ListImage155 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmGH.frx":12B89
            Key             =   ""
         EndProperty
         BeginProperty ListImage156 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmGH.frx":12D12
            Key             =   ""
         EndProperty
         BeginProperty ListImage157 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmGH.frx":12EA1
            Key             =   ""
         EndProperty
         BeginProperty ListImage158 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmGH.frx":13029
            Key             =   ""
         EndProperty
         BeginProperty ListImage159 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmGH.frx":13173
            Key             =   ""
         EndProperty
         BeginProperty ListImage160 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmGH.frx":132F7
            Key             =   ""
         EndProperty
         BeginProperty ListImage161 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmGH.frx":13483
            Key             =   ""
         EndProperty
         BeginProperty ListImage162 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmGH.frx":1357A
            Key             =   ""
         EndProperty
         BeginProperty ListImage163 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmGH.frx":13702
            Key             =   ""
         EndProperty
         BeginProperty ListImage164 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmGH.frx":1388F
            Key             =   ""
         EndProperty
         BeginProperty ListImage165 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmGH.frx":13A19
            Key             =   ""
         EndProperty
         BeginProperty ListImage166 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmGH.frx":13BA3
            Key             =   ""
         EndProperty
         BeginProperty ListImage167 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmGH.frx":13D32
            Key             =   ""
         EndProperty
         BeginProperty ListImage168 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmGH.frx":13EBF
            Key             =   ""
         EndProperty
         BeginProperty ListImage169 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmGH.frx":14052
            Key             =   ""
         EndProperty
         BeginProperty ListImage170 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmGH.frx":141DE
            Key             =   ""
         EndProperty
         BeginProperty ListImage171 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmGH.frx":14372
            Key             =   ""
         EndProperty
         BeginProperty ListImage172 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmGH.frx":144FA
            Key             =   ""
         EndProperty
         BeginProperty ListImage173 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmGH.frx":1468F
            Key             =   ""
         EndProperty
         BeginProperty ListImage174 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmGH.frx":14821
            Key             =   ""
         EndProperty
         BeginProperty ListImage175 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmGH.frx":149A3
            Key             =   ""
         EndProperty
         BeginProperty ListImage176 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmGH.frx":14B2E
            Key             =   ""
         EndProperty
         BeginProperty ListImage177 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmGH.frx":14CB2
            Key             =   ""
         EndProperty
         BeginProperty ListImage178 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmGH.frx":14E39
            Key             =   ""
         EndProperty
         BeginProperty ListImage179 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmGH.frx":14FBE
            Key             =   ""
         EndProperty
         BeginProperty ListImage180 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmGH.frx":15143
            Key             =   ""
         EndProperty
         BeginProperty ListImage181 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmGH.frx":152CE
            Key             =   ""
         EndProperty
         BeginProperty ListImage182 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmGH.frx":15452
            Key             =   ""
         EndProperty
         BeginProperty ListImage183 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmGH.frx":155DF
            Key             =   ""
         EndProperty
         BeginProperty ListImage184 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmGH.frx":1576C
            Key             =   ""
         EndProperty
         BeginProperty ListImage185 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmGH.frx":158F4
            Key             =   ""
         EndProperty
         BeginProperty ListImage186 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmGH.frx":15A7E
            Key             =   ""
         EndProperty
         BeginProperty ListImage187 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmGH.frx":15C05
            Key             =   ""
         EndProperty
         BeginProperty ListImage188 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmGH.frx":15D8A
            Key             =   ""
         EndProperty
         BeginProperty ListImage189 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmGH.frx":15F0F
            Key             =   ""
         EndProperty
         BeginProperty ListImage190 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmGH.frx":16096
            Key             =   ""
         EndProperty
         BeginProperty ListImage191 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmGH.frx":16224
            Key             =   ""
         EndProperty
         BeginProperty ListImage192 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmGH.frx":16343
            Key             =   ""
         EndProperty
         BeginProperty ListImage193 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmGH.frx":164D1
            Key             =   ""
         EndProperty
         BeginProperty ListImage194 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmGH.frx":1665A
            Key             =   ""
         EndProperty
         BeginProperty ListImage195 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmGH.frx":167E5
            Key             =   ""
         EndProperty
         BeginProperty ListImage196 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmGH.frx":16970
            Key             =   ""
         EndProperty
         BeginProperty ListImage197 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmGH.frx":16AFE
            Key             =   ""
         EndProperty
         BeginProperty ListImage198 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmGH.frx":16C86
            Key             =   ""
         EndProperty
         BeginProperty ListImage199 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmGH.frx":16D90
            Key             =   ""
         EndProperty
         BeginProperty ListImage200 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmGH.frx":16F11
            Key             =   ""
         EndProperty
         BeginProperty ListImage201 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmGH.frx":17098
            Key             =   ""
         EndProperty
         BeginProperty ListImage202 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmGH.frx":17220
            Key             =   ""
         EndProperty
         BeginProperty ListImage203 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmGH.frx":173A6
            Key             =   ""
         EndProperty
         BeginProperty ListImage204 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmGH.frx":1752B
            Key             =   ""
         EndProperty
         BeginProperty ListImage205 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmGH.frx":176B5
            Key             =   ""
         EndProperty
         BeginProperty ListImage206 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmGH.frx":17849
            Key             =   ""
         EndProperty
         BeginProperty ListImage207 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmGH.frx":179D0
            Key             =   ""
         EndProperty
         BeginProperty ListImage208 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmGH.frx":17B54
            Key             =   ""
         EndProperty
         BeginProperty ListImage209 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmGH.frx":17CE9
            Key             =   ""
         EndProperty
         BeginProperty ListImage210 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmGH.frx":17E78
            Key             =   ""
         EndProperty
         BeginProperty ListImage211 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmGH.frx":1800A
            Key             =   ""
         EndProperty
         BeginProperty ListImage212 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmGH.frx":18189
            Key             =   ""
         EndProperty
         BeginProperty ListImage213 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmGH.frx":1830E
            Key             =   ""
         EndProperty
         BeginProperty ListImage214 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmGH.frx":184A2
            Key             =   ""
         EndProperty
         BeginProperty ListImage215 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmGH.frx":18629
            Key             =   ""
         EndProperty
         BeginProperty ListImage216 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmGH.frx":187B4
            Key             =   ""
         EndProperty
         BeginProperty ListImage217 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmGH.frx":1891C
            Key             =   ""
         EndProperty
         BeginProperty ListImage218 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmGH.frx":18AA1
            Key             =   ""
         EndProperty
         BeginProperty ListImage219 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmGH.frx":18C2C
            Key             =   ""
         EndProperty
         BeginProperty ListImage220 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmGH.frx":18DB1
            Key             =   ""
         EndProperty
         BeginProperty ListImage221 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmGH.frx":18F3B
            Key             =   ""
         EndProperty
         BeginProperty ListImage222 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmGH.frx":190BF
            Key             =   ""
         EndProperty
         BeginProperty ListImage223 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmGH.frx":19249
            Key             =   ""
         EndProperty
         BeginProperty ListImage224 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmGH.frx":193CD
            Key             =   ""
         EndProperty
         BeginProperty ListImage225 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmGH.frx":1955D
            Key             =   ""
         EndProperty
         BeginProperty ListImage226 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmGH.frx":196E8
            Key             =   ""
         EndProperty
         BeginProperty ListImage227 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmGH.frx":1987D
            Key             =   ""
         EndProperty
         BeginProperty ListImage228 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmGH.frx":19A10
            Key             =   ""
         EndProperty
         BeginProperty ListImage229 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmGH.frx":19B9F
            Key             =   ""
         EndProperty
         BeginProperty ListImage230 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmGH.frx":19D2A
            Key             =   ""
         EndProperty
         BeginProperty ListImage231 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmGH.frx":19EB4
            Key             =   ""
         EndProperty
         BeginProperty ListImage232 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmGH.frx":1A039
            Key             =   ""
         EndProperty
         BeginProperty ListImage233 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmGH.frx":1A1BC
            Key             =   ""
         EndProperty
         BeginProperty ListImage234 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmGH.frx":1A340
            Key             =   ""
         EndProperty
         BeginProperty ListImage235 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmGH.frx":1A4C5
            Key             =   ""
         EndProperty
         BeginProperty ListImage236 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmGH.frx":1A5E5
            Key             =   ""
         EndProperty
         BeginProperty ListImage237 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmGH.frx":1A770
            Key             =   ""
         EndProperty
         BeginProperty ListImage238 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmGH.frx":1A8FF
            Key             =   ""
         EndProperty
         BeginProperty ListImage239 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmGH.frx":1AA90
            Key             =   ""
         EndProperty
         BeginProperty ListImage240 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmGH.frx":1AC18
            Key             =   ""
         EndProperty
         BeginProperty ListImage241 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmGH.frx":1ADA1
            Key             =   ""
         EndProperty
         BeginProperty ListImage242 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmGH.frx":1AF2E
            Key             =   ""
         EndProperty
         BeginProperty ListImage243 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmGH.frx":1B0B6
            Key             =   ""
         EndProperty
         BeginProperty ListImage244 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmGH.frx":1B244
            Key             =   ""
         EndProperty
         BeginProperty ListImage245 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmGH.frx":1B3D0
            Key             =   ""
         EndProperty
         BeginProperty ListImage246 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmGH.frx":1B564
            Key             =   ""
         EndProperty
         BeginProperty ListImage247 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmGH.frx":1B6F9
            Key             =   ""
         EndProperty
         BeginProperty ListImage248 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmGH.frx":1B87C
            Key             =   ""
         EndProperty
         BeginProperty ListImage249 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmGH.frx":1B9FC
            Key             =   ""
         EndProperty
         BeginProperty ListImage250 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmGH.frx":1BB7E
            Key             =   ""
         EndProperty
         BeginProperty ListImage251 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmGH.frx":1BD07
            Key             =   ""
         EndProperty
         BeginProperty ListImage252 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmGH.frx":1BF09
            Key             =   ""
         EndProperty
         BeginProperty ListImage253 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmGH.frx":1C16B
            Key             =   ""
         EndProperty
      EndProperty
   End
   Begin MSComctlLib.ListView lvGames 
      Height          =   735
      Index           =   0
      Left            =   0
      TabIndex        =   8
      TabStop         =   0   'False
      Top             =   360
      Width           =   5535
      _ExtentX        =   9763
      _ExtentY        =   1296
      View            =   3
      LabelEdit       =   1
      Sorted          =   -1  'True
      LabelWrap       =   -1  'True
      HideSelection   =   0   'False
      AllowReorder    =   -1  'True
      FullRowSelect   =   -1  'True
      GridLines       =   -1  'True
      _Version        =   393217
      Icons           =   "ImageList1"
      SmallIcons      =   "ImageList1"
      ColHdrIcons     =   "ImageListSortIconIndicator"
      ForeColor       =   -2147483640
      BackColor       =   -2147483643
      Appearance      =   1
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "Microsoft Sans Serif"
         Size            =   8.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      NumItems        =   5
      BeginProperty ColumnHeader(1) {BDD1F052-858B-11D1-B16A-00C0F0283628} 
         Object.Tag             =   "STRING"
         Text            =   "Games (0)"
         Object.Width           =   2091
      EndProperty
      BeginProperty ColumnHeader(2) {BDD1F052-858B-11D1-B16A-00C0F0283628} 
         SubItemIndex    =   1
         Object.Tag             =   "STRING"
         Text            =   "Pass"
         Object.Width           =   926
      EndProperty
      BeginProperty ColumnHeader(3) {BDD1F052-858B-11D1-B16A-00C0F0283628} 
         SubItemIndex    =   2
         Object.Tag             =   "STRING"
         Text            =   "CC"
         Object.Width           =   688
      EndProperty
      BeginProperty ColumnHeader(4) {BDD1F052-858B-11D1-B16A-00C0F0283628} 
         SubItemIndex    =   3
         Object.Tag             =   "STRING"
         Text            =   "Map"
         Object.Width           =   1693
      EndProperty
      BeginProperty ColumnHeader(5) {BDD1F052-858B-11D1-B16A-00C0F0283628} 
         SubItemIndex    =   4
         Object.Tag             =   "STRING"
         Text            =   "GH"
         Object.Width           =   741
      EndProperty
   End
   Begin VB.Label lblHide 
      Height          =   195
      Left            =   8400
      TabIndex        =   16
      Top             =   3480
      Width           =   525
   End
   Begin VB.Image imgBanner 
      Height          =   795
      Left            =   4920
      Picture         =   "frmGH.frx":1C36D
      Top             =   4080
      Width           =   6750
   End
   Begin VB.Menu mnuFile 
      Caption         =   "&File"
      Begin VB.Menu mnuFileSignIn 
         Caption         =   "Sign &In"
         Shortcut        =   ^I
      End
      Begin VB.Menu mnuFileCreateGame 
         Caption         =   "Create &Game"
         Shortcut        =   ^G
      End
      Begin VB.Menu mnuFileSignOut 
         Caption         =   "Sign Out"
         Enabled         =   0   'False
         Shortcut        =   ^O
      End
      Begin VB.Menu mnuFileSep0 
         Caption         =   "-"
      End
      Begin VB.Menu mnuFileTray 
         Caption         =   "Send to &Tray"
         Shortcut        =   ^T
      End
      Begin VB.Menu mnuFileExit 
         Caption         =   "E&xit"
      End
   End
   Begin VB.Menu mnuEdit 
      Caption         =   "&Edit"
      Begin VB.Menu mnuEditUndo 
         Caption         =   "&Undo"
      End
      Begin VB.Menu mnuEditSep1 
         Caption         =   "-"
      End
      Begin VB.Menu mnuEditCut 
         Caption         =   "Cu&t"
      End
      Begin VB.Menu mnuEditCopy 
         Caption         =   "&Copy"
      End
      Begin VB.Menu mnuEditPaste 
         Caption         =   "&Paste"
      End
      Begin VB.Menu mnuEditDelete 
         Caption         =   "&Delete"
      End
      Begin VB.Menu mnuEditSep2 
         Caption         =   "-"
      End
      Begin VB.Menu mnuEditSelAll 
         Caption         =   "Select &All"
      End
   End
   Begin VB.Menu mnuDisplay 
      Caption         =   "&View"
      Begin VB.Menu mnuViewTimestamp 
         Caption         =   "&Timestamp"
         Checked         =   -1  'True
      End
      Begin VB.Menu mnuViewGridlines 
         Caption         =   "&Gridlines"
         Checked         =   -1  'True
      End
      Begin VB.Menu mnuViewHighlight 
         Caption         =   "&Highlight alert words"
         Checked         =   -1  'True
      End
      Begin VB.Menu mnuTheme 
         Caption         =   "-"
      End
      Begin VB.Menu mnuViewBMTheme 
         Caption         =   "&Standard Theme"
         Checked         =   -1  'True
      End
      Begin VB.Menu mnuViewGTA2Theme 
         Caption         =   "GTA&2 Theme"
      End
      Begin VB.Menu mnuViewClassicTheme 
         Caption         =   "&Classic Theme"
      End
   End
   Begin VB.Menu mnuTools 
      Caption         =   "&Tools"
      Begin VB.Menu mnuToolsOptions 
         Caption         =   "&Options..."
         Shortcut        =   {F4}
      End
      Begin VB.Menu mnuToolsGTA2manager 
         Caption         =   "GTA2 &Manager..."
         Shortcut        =   {F8}
      End
      Begin VB.Menu mnuToolsUnPnP 
         Caption         =   "UnPnP"
         Visible         =   0   'False
      End
   End
   Begin VB.Menu mnuHelp 
      Caption         =   "&Help"
      Begin VB.Menu mnuHelpCommands 
         Caption         =   "&Keys, commands and links"
         Shortcut        =   {F1}
      End
      Begin VB.Menu mnuHelpAbout 
         Caption         =   "&About..."
         Shortcut        =   {F6}
      End
   End
End
Attribute VB_Name = "frmGH"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
'Copyright 2005, 2011 GTAMP.com gtamulti@gmail.com

'This program is free software: you can redistribute it and/or modify
'it under the terms of the GNU General Public License as published by
'the Free Software Foundation, either version 3 of the License, or
'(at your option) any later version.
'
'This program is distributed in the hope that it will be useful,
'but WITHOUT ANY WARRANTY; without even the implied warranty of
'MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
'GNU General Public License for more details.
'
'You should have received a copy of the GNU General Public License
'along with this program.  If not, see <http://www.gnu.org/licenses/>

'''Changes by Ben Millard, 2010-04-25 to 2010-10-26
'''BenMillard marks code he changes like this.

Option Explicit

'Mouse API and constants
'Private Const IDC_APPSTARTING = 32650&
Private Const IDC_HAND = 32649&
'Private Const IDC_ARROW = 32512&
'Private Const IDC_CROSS = 32515&
'Private Const IDC_IBEAM = 32513&
'Private Const IDC_ICON = 32641&
'Private Const IDC_NO = 32648&
'Private Const IDC_SIZE = 32640&
'Private Const IDC_SIZEALL = 32646&
'Private Const IDC_SIZENESW = 32643&
'Private Const IDC_SIZENS = 32645&
'Private Const IDC_SIZENWSE = 32642&
'Private Const IDC_SIZEWE = 32644&
'Private Const IDC_UPARROW = 32516&
'Private Const IDC_WAIT = 32514&

Private Declare Function LoadCursorLong Lib "user32" Alias "LoadCursorA" _
  (ByVal hInstance As Long, ByVal lpCursorName As Long) As Long

Private Declare Function SetCursor Lib "user32" _
  (ByVal hCursor As Long) As Long

'Misc variables
Dim intPrevWinState As Integer 'Stores the windowstate before GH is sent to tray
Dim blnCreateGameLoaded As Boolean 'true once CreateGame form has been displayed once
Dim lngLobby As Long
Dim intTheme As Integer
Dim blnReconnect As Boolean 'true if GH should reconnect
Dim intReconnect As Integer
Dim intSecondsWaited As Integer
Dim blnCalculatedGTA2checksum 'true if GTA2.exe CRC32 checksum has been calculated, false if you close GTA2
Dim intPreviousMapIndex As Integer 'GTA2 registry key
Dim strPreviousMapFile As String 'GMP file
Dim strPreviousScriptFile As String 'SCR file
Dim SortedArray As New cSortArray 'Stores map descriptions and sorts them like GTA2
Dim strHostCommentLastJoined As String 'The comment for the game the player last joined
Dim m_hwndEdit As Long
Dim IDL As Long, aPath As String 'used for special folders like program_files
Dim lCRC32 As Long 'stores file CRC
Dim blnConnectClick As Boolean
Dim blnItemInList As Boolean 'true if an item is found in a list
Dim blnDisconnect As Boolean 'true if disconnect() has been called
Dim strOldState As String
Dim cR As New cRegistry
Dim strPort As String 'IRC network port
Dim blnCommand As Boolean

Private Declare Function CommandLineToArgv Lib "shell32" Alias "CommandLineToArgvW" ( _
    ByVal lpCmdLine As Long, pNumArgs As Integer) As Long
Private Declare Function GlobalFree Lib "kernel32" ( _
    ByVal hMem As Long) As Long
Private Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" ( _
    pTo As Any, uFrom As Any, ByVal lSize As Long)
Private Declare Function SysAllocString Lib "oleaut32" (ByVal pwsz As Long) As Long

Private Declare Function LocalFree Lib "kernel32" (ByVal hMem As Long) As Long
Private Declare Function SHGetPathFromIDList Lib "shell32.dll" Alias "SHGetPathFromIDListA" (ByVal pidl As Long, ByVal pszPath As String) As Long
Private Declare Function SHGetSpecialFolderLocation Lib "shell32.dll" (ByVal hwndOwner As Long, ByVal nFolder As Long, pidl As Any) As Long
'API call to get the XP effects:
Private Declare Function InitCommonControls Lib "Comctl32.dll" () As Long
'Detect mouse button
'Private Declare Function GetAsyncKeyState Lib "user32"(ByVal vKey As Long) As Integer
Private Const VK_LBUTTON = &H1
Private Const VK_RBUTTON = &H2

'Elypter's code
'Private Sub cmdP_Click()
'    Dim intChatbox As Integer
'    Dim i As Integer
'    intChatbox = -1
'    For i = 0 To rtbChatbox.UBound
'        If LCase(rtbChatbox(i).Tag) = LCase(tabIRC.SelectedItem) Then
'            intChatbox = i
'            Exit For
'        End If
'    Next
'    If intChatbox = -1 Then Exit Sub
'
'    send "JOIN " & rtbChatbox(intChatbox).Text
'    rtbChatbox(intChatbox).Text = vbNullString    'clear the field
'End Sub

Private Sub cmdCancel_Click()
    blnCancel = True
End Sub

Private Sub cmdX_Click()
    Call form_KeyDown(vbKeyW, vbCtrlMask)
End Sub

'Elypter's code
'Private Sub cmdEnter_Click()
    'lvGames_click (0)
'End Sub


Public Function URLdecshort(ByRef Text As String) As String
    Dim strArray() As String, lngA As Long
    strArray = Split(Replace(Text, "+", " "), "%")
    For lngA = 1 To UBound(strArray)
        strArray(lngA) = Chr$("&H" & Left$(strArray(lngA), 2)) & Mid$(strArray(lngA), 3)
    Next lngA
    URLdecshort = Join(strArray, vbNullString)
End Function

Public Function URLencshort(ByRef Text As String) As String
    Dim lngA As Long, strChar As String
    For lngA = 1 To Len(Text)
        strChar = Mid$(Text, lngA, 1)
        If strChar Like "[A-Za-z0-9]" Then
        ElseIf strChar = " " Then
            strChar = "+"
        Else
            strChar = "%" & Right$("0" & Hex$(Asc(strChar)), 2)
        End If
        URLencshort = URLencshort & strChar
    Next lngA
End Function

Public Function sUniPtrZToVBString(lStrptr As Long) As String
' Convert 'pointer to (wide-)null-terminated Unicode string' to a 'VB string Value '
    sUniPtrZToVBString = vbNullString
    lStrptr = SysAllocString(lStrptr)
    CopyMemory ByVal VarPtr(sUniPtrZToVBString), ByVal VarPtr(lStrptr), 4
End Function

Private Function ParseCommandLine() As String()
' Parse the current command line and return an Argv() array of strings
Dim lpArgv As Long, lpStr As Long
Dim lArgc As Integer
Dim i As Integer
Dim sArgs() As String
Dim decoded As String
    ' Parse the command line, breaking it up into separate options/parameters
    decoded = command$()
    MsgBox (decoded)
    If Right(decoded, 1) = "/" Then decoded = Mid(decoded, 1, Len(decoded) - 1)
    MsgBox (decoded)
    lpArgv = CommandLineToArgv(StrPtr(URLdecshort(decoded)), lArgc)
    ' Resize our array to hold the component strings
    ReDim sArgs(lArgc - 1)
    For i = 0 To lArgc - 1
        ' Get the address of the Unicode text for the i'th component
        CopyMemory lpStr, ByVal lpArgv + 4 * i, 4
        ' Convert this to a proper VB string value, and store it in out array
        sArgs(i) = sUniPtrZToVBString(lpStr)
    Next i
    ' Return the string array to our caller
    ParseCommandLine = sArgs
    ' Free the memory allocated by CommandLineToArgvW
    GlobalFree lpArgv
End Function

Private Sub Form_Load()

On Error GoTo oops

'Set colors
strServerColor = 32768
strCTCPcolor = 8388736
strTextColor = vbBlack
strConnectionColor = 8388736   'QBColor(Val("&H" & 5)) purple
strHelpColor = 8388736
strActionColor = 8388736
strTopicColor = vbBlack
strBannedColor = vbRed
strGHColor = 32896             'QBColor(Val("&H" & 6)) tan
strPrivateMessageColor = 128   'QBColor(Val("&H" & 4)) brown

bln98 = getVersion 'true if Windows 98


''Detect special folders
'  aPath = Space$(MAX_PATH)
'
'  Dim p
'  For p = 1 To 200
'  If SHGetSpecialFolderLocation(hwnd, p, IDL) = 0 Then
'        If SHGetPathFromIDList(IDL, aPath) Then
'            PROGRAM_FILES = Left$(aPath, InStr(aPath, vbNullChar) - 1)
'            Debug.Print p & " " & Left$(aPath, InStr(aPath, vbNullChar) - 1)
'        End If
'        LocalFree IDL
'  End If
'  Next p
'  Exit Sub

'Store Windows folder in WINDOWS_FOLDER global string
aPath = Space$(MAX_PATH)
If SHGetSpecialFolderLocation(hwnd, 36, IDL) = 0 Then
      If SHGetPathFromIDList(IDL, aPath) Then
          WINDOWS_FOLDER = Left$(aPath, InStr(aPath, vbNullChar) - 1)
      End If
      LocalFree IDL
End If

'Store Programs Files folder in PROGRAM_FILES global string
aPath = Space$(MAX_PATH)
If SHGetSpecialFolderLocation(hwnd, 38, IDL) = 0 Then
      If SHGetPathFromIDList(IDL, aPath) Then
          PROGRAM_FILES = Left$(aPath, InStr(aPath, vbNullChar) - 1)
      End If
      LocalFree IDL
End If

'Store documents folder in DOCUMENTS global string
'aPath = Space$(MAX_PATH)
'If SHGetSpecialFolderLocation(hwnd, 5, IDL) = 0 Then
'      If SHGetPathFromIDList(IDL, aPath) Then
'          Debug.Print Left$(aPath, InStr(aPath, vbNullChar) - 1)
'      End If
'      LocalFree IDL
'End If

'''EnableAutoURLDetection rtbHistory(0)
'''EnableAutoURLDetection rtbTopic(0)

rtbTopic(0).SelStart = 0
rtbTopic(0).SelLength = 666
rtbTopic(0).SelText = "http://GTAMP.com http://GTAMP.com/forum"

strPasswordProtectGame = "No"
intNickservWaitTime = -1
strChannel = "#gta2gh"
strDestTab = vbNullString

m_hwndEdit = rtbHistory(tabIRC.SelectedItem.Index - 1).hwnd

' No shortcut key text until the context menu is shown & hidden
SetEditMenuItemText False

Randomize

With cR
    'Force debug tab, blood, debug keys and min_frame_rate
    .ClassKey = HKEY_CURRENT_USER
    .SectionKey = "Software\DMA Design Ltd\GTA2\Debug\"
    .ValueKey = "bob_debug_display"
    .ValueType = REG_DWORD
    .Value = 1
    .ValueKey = "do_blood"
    .ValueType = REG_DWORD
    .Value = 1
    .ValueKey = "do_debug_keys"
    .ValueType = REG_DWORD
    .Value = 1
    .SectionKey = "Software\DMA Design Ltd\GTA2\screen\"
    .ValueKey = "min_frame_rate"
    .ValueType = REG_DWORD
    .Value = 1
    .ValueKey = "gamma"
    If .Value = 0 Then .Value = 15

    'IRC settings:
    .ClassKey = HKEY_CURRENT_USER
    .SectionKey = "SOFTWARE\GTA2 Game Hunter"
    'Load IRC username from registry
    .ValueKey = "Username"
    strPreferedNick = .Value
    'Load timestamp display setting
    .ValueKey = "chkTimestamp"
    If .Value = vbNullString Then
        blnchkTime = True
        .ValueType = REG_DWORD
        .Value = 1
    Else
        blnchkTime = .Value
    End If
End With

strNick = Left$(strPreferedNick, 16)

blnDisconnectClick = True

'Set country codes:
strCountries = Array("Somewhere - ??", _
"Afghanistan - AF", "Aland Islands - AW", "Albania - AL", "Algeria - DZ", "American Samoa - AS", "Andorra - AD", "Angola - AO", "Anguilla - AI", "Antarctica - AQ", "Antigua and Barbuda - AG", "Argentina - AR", "Armenia - AM", "Aruba - AW", "Australia - AU", "Austria - AT", "Azerbaijan - AZ", "Bahamas - BS", "Bahrain - BH", "Barbados - BB", "Bangladesh - BD", "Belarus - BY", "Belgium - BE", "Belize - BZ", "Benin - BJ", "Bermuda - BM", "Bahamas - BS", "Bhutan - BT", "Botswana - BW", "Bolivia - BO", "Bosnia and Herzegovina - BA", "Bouvet Island - BV", "Brazil - BR", "British Indian Ocean Territory - IO", "Brunei Darussalam - BN", "Bulgaria - BG", "Burkina Faso - BF", "Burundi - BI", "Cambodia - KH", "Cameroon - CM", "Canada - CA", "Cape Verde - CV", "Cayman Islands - KY", "Central African Republic - CF", "Chad - TD", "Chile - CL", "China - CN", "Christmas Island - CX", "Cocos (Keeling) Islands - CC", "Colombia - CO", "Comoros - KM", "Congo - CG", "Congo, Democratic Republic - CD", "Cook Islands - CK", _
"Costa Rica - CR", "Cote D'Ivoire (Ivory Coast) - CI", "Croatia (Hrvatska) - HR", "Cuba - CU", "Cyprus - CY", "Czech Republic - CZ", "Czechoslovakia (former) - CS", "Denmark - DK", "Djibouti - DJ", "Dominica - DM", "Dominican Republic - DO", "Ecuador - EC", "Egypt - EG", "El Salvador - SV", "Equatorial Guinea - GQ", "Eritrea - ER", "Estonia - EE", "Ethiopia - ET", "European Union - EU", "Falkland Islands (Malvinas) - FK", "Faroe Islands - FO", "Fiji - FJ", "Finland - FI", "France - FR", "France, Metropolitan - FX", "French Guiana - GF", "French Polynesia - PF", "French Southern Territories - TF", "F.Y.R.O.M. (Macedonia) - MK", "Gabon - GA", "Gambia - GM", "Georgia - GE", "Germany - DE", "Ghana - GH", "Gibraltar - GI", "Greece - GR", "Greenland - GL", "Grenada - GD", "Guadeloupe - GP", "Guam - GU", "Guatemala - GT", "Guernsey - GF", "Guinea - GN", "Guinea-Bissau - GW", "Guyana - GY", "Haiti - HT", "Heard and McDonald Islands - HM", "Honduras - HN", "Hong Kong - HK", "Hungary - HU", _
"Iceland - IS", "India - IN", "Indonesia - ID", "Iran - IR", "Iraq - IQ", "Ireland - IE", "Israel - IL", "Isle of Man - IM", "Italy - IT", "Jersey - JE", "Jamaica - JM", "Japan - JP", "Jordan - JO", "Kazakhstan - KZ", "Kenya - KE", "Kiribati - KI", "Korea (North) - KP", "Korea (South) - KR", "Kuwait - KW", "Kyrgyzstan - KG", "Laos - LA", "Latvia - LV", "Lebanon - LB", "Liechtenstein - LI", "Liberia - LR", "Libya - LY", "Lesotho - LS", "Lithuania - LT", "Luxembourg - LU", "Macau - MO", "Madagascar - MG", "Malawi - MW", "Malaysia - MY", "Maldives - MV", "Mali - ML", "Malta - MT", "Marshall Islands - MH", "Martinique - MQ", "Mauritania - MR", "Mauritius - MU", "Mayotte - YT", "Mexico - MX", "Micronesia - FM", "Monaco - MC", "Moldova - MD", "Morocco - MA", "Mongolia - MN", "Montenegro - ME", _
"Montserrat - MS", "Mozambique - MZ", "Myanmar - MM", "Namibia - NA", "Nauru - NR", "Nepal - NP", "Netherlands - NL", "Netherlands Antilles - AN", "Neutral Zone - NT", "New Caledonia - NC", "New Zealand - NZ", "Nicaragua - NI", _
"Niger - NE", "Nigeria - NG", "Niue - NU", "Norfolk Island - NF", "Northern Mariana Islands - MP", "Norway - NO", "Oman - OM", "Pakistan - PK", "Palau - PW", "Palestinian Territory, Occupied - PS", "Panama - PA", "Papua New Guinea - PG", "Paraguay - PY", "Peru - PE", "Philippines - PH", "Pitcairn - PN", "Poland - PL", "Portugal - PT", "Puerto Rico - PR", "Qatar - QA", "Reunion - RE", "Romania - RO", "Russian Federation - RU", "Rwanda - RW", "S. Georgia and S. Sandwich Isls. - GS", "Saint Kitts and Nevis - KN", "Saint Lucia - LC", "Saint Vincent & the Grenadines - VC", "Samoa - WS", "San Marino - SM", "Sao Tome and Principe - ST", "Saudi Arabia - SA", "Senegal - SN", "Serbia - RS", "Seychelles - SC", "Sierra Leone - SL", "Singapore - SG", "Slovenia - SI", "Slovak Republic - SK", "Solomon Islands - SB", "Somalia - SO", "South Africa - ZA", "Spain - ES", "Sri Lanka - LK", "St. Helena - SH", "St. Pierre and Miquelon - PM", "Sudan - SD", "Suriname - SR", "Svalbard & Jan Mayen Islands - SJ", _
"Swaziland - SZ", "Sweden - SE", "Switzerland - CH", "Syria - SY", "Taiwan - TW", "Tajikistan - TJ", "Tanzania - TZ", "Thailand - TH", "Timor-Leste - TL", "Togo - TG", "Tokelau - TK", "Tonga - TO", "Trinidad and Tobago - TT", "Tunisia - TN", "Turkey - TR", "Turkmenistan - TM", "Turks and Caicos Islands - TC", "Tuvalu - TV", "Uganda - UG", "Ukraine - UA", "United Arab Emirates - AE", "United Kingdom - UK", "United States - US", "US Minor Outlying Islands - UM", "Uruguay - UY", "Uzbekistan - UZ", "Vanuatu - VU", "Vatican City State (Holy See) - VA", "Venezuela - VE", "Viet Nam - VN", "Virgin Islands (British) - VG", "Virgin Islands (U.S.) - VI", "Wallis and Futuna Islands - WF", "Western Sahara - EH", "Yemen - YE", "Zambia - ZM", "Zimbabwe - ZW", "Icecream - IC", "C64 - 64", "Hedgewars - HW")
    
strEurope = Array( _
, "Albania - AL", "Andorra - AD", "Austria - AT", "Belarus - BY", "Belgium - BE", "Bosnia and Herzegovina - BA", "Bulgaria - BG", "Burkina Faso - BF", _
"Croatia (Hrvatska) - HR", "Cyprus - CY", "Czech Republic - CZ", "Czechoslovakia (former) - CS", "Denmark - DK", "Estonia - EE", "Ethiopia - ET", "European Union - EU", "Falkland Islands (Malvinas) - FK", "Faroe Islands - FO", "Finland - FI", "France - FR", "France, Metropolitan - FX", "F.Y.R.O.M. (Macedonia) - MK", "Germany - DE", "Ghana - GH", "Greece - GR", "Greenland - GL", "Hungary - HU", _
"Iceland - IS", "Ireland - IE", "Isle of Man - IM", "Italy - IT", "Latvia - LV", "Liechtenstein - LI", "Lithuania - LT", "Luxembourg - LU", "Malta - MT", "Mauritius - MU", "Monaco - MC", "Moldova - MD", "Morocco - MA", "Montenegro - ME", _
"Netherlands - NL", _
"Norway - NO", "Poland - PL", "Portugal - PT", "Romania - RO", "San Marino - SM", "Serbia - RS", "Slovenia - SI", "Slovak Republic - SK", "Spain - ES", _
"Sweden - SE", "Switzerland - CH", "Ukraine - UA", "United Kingdom - UK", "Vatican City State (Holy See) - VA")
        
    
'Used for finding a country code position to help insert a flag in the imagelist
'Dim i As Integer
'For i = 0 To UBound(strCountries)
'If Right$(strCountries(i), 2) = "ME" Then MsgBox i + 1
'Next i

strServer(0) = "85.17.97.63"
'strServer(0) = "irc.gtanet.com"
'strServer(1) = "maple.nl.eu.gtanet.com"
'strServer(0) = "127.0.0.1"

picTray = Me.Icon

With cR
    .ClassKey = HKEY_CURRENT_USER
    .SectionKey = "SOFTWARE\GTA2 Game Hunter"
    
    '''Window size and position (most visible settings should be first):
    .SectionKey = "SOFTWARE\GTA2 Game Hunter\display"
    .ValueKey = "Top"
    If .Value <> vbNullString And .Value >= -20000 And .Value <= 50000 Then Top = .Value
    .ValueKey = "Left"
    If .Value <> vbNullString And .Value >= -20000 And .Value <= 50000 Then Left = .Value
    .ValueKey = "Width"
    If .Value <> vbNullString And .Value >= -20000 And .Value <= 50000 Then Width = .Value
    .ValueKey = "Height"
    If .Value <> vbNullString And .Value >= 1000 And .Value <= 50000 Then Height = .Value
    .ValueKey = "WindowState"
    If .Value = vbNullString Then .Value = vbMaximized
    If .Value = "0" Or .Value = "2" Then
        WindowState = .Value
    End If
    
    'Create Game password:
    .ClassKey = HKEY_CURRENT_USER
    .SectionKey = "SOFTWARE\GTA2 Game Hunter"
    .ValueKey = "Password"
    If .Value <> vbNullString Then
        strPassword = .Value
    Else
        strPassword = "x"
    End If
    
    'Play sounds:
    .ValueKey = "Sound"
    strWave = .Value
    
    'Set sorting arrows and options on main ListViews:
    lvGames(0).ColumnHeaderIcons = ImageListSortIconIndicator 'imagelist1 '''
    lvPlayers(0).ColumnHeaderIcons = ImageListSortIconIndicator  '''
        
    'Players list sorting options:
    .ClassKey = HKEY_CURRENT_USER
    .SectionKey = "SOFTWARE\GTA2 Game Hunter\display"
    .ValueKey = "lvPlayers(0).SortOrder"
    lvPlayers(0).SortOrder = .Value
    .ValueKey = "lvPlayers(0).SortKey"
    lvPlayers(0).SortKey = .Value
    Call SortColumn(frmGH.lvPlayers(0), .Value + 1)
    
    'Games list sorting options:
    .ClassKey = HKEY_CURRENT_USER
    .SectionKey = "SOFTWARE\GTA2 Game Hunter\display"
    .ValueKey = "lvGames(0).SortOrder"
    lvGames(0).SortOrder = .Value
    .ValueKey = "lvGames(0).SortKey"
    lvGames(0).SortKey = .Value
    Call SortColumn(frmGH.lvGames(0), .Value + 1)
    
End With 'with Cr

tabIRC.Top = Me.ScaleHeight - rtbChatbox(0).Height
rtbChatbox(0).Top = tabIRC.Top - tabIRC.Height
rtbHistory(0).Top = rtbTopic(0).Top + rtbTopic(0).Height + 20
rtbHistory(0).Height = rtbChatbox(0).Top - (rtbTopic(0).Top + rtbChatbox(0).Height + tabIRC.Height) + 90

'  .ClassKey = HKEY_CURRENT_USER
'  .SectionKey = "Software\DMA Design Ltd\GTA2\Option"
'  .ValueKey = "Language"
'  strLanguage = .Value

'Load settings for Settings window:
Call frmOptions.loadSettings

'''Starting as a bot?
blnBot = False
If blnBot Then
    frmGH.Caption = "GH Bot v" & TXT_GHVER
Else
    frmGH.Caption = "Game Hunter v" & TXT_GHVER
End If

'Start in the systray if Run at startup is ticked
If blnchkStartup = True Or blnchkStartTray = True Then mnuFileTray_Click

'mpaddon Call frmProbeGTA2.listenForGameName
'Call frmProbeGTA2.listen2302to2400

'Load and apply theming system:
With cR
    .ClassKey = HKEY_CURRENT_USER
    .SectionKey = "SOFTWARE\GTA2 Game Hunter\display"
    .ValueKey = "Theme"
    intTheme = .Value
    Select Case intTheme
        Case 0, 1
            mnuViewBMTheme_Click
            Call loadViewSettings
        Case 2
            mnuViewGTA2Theme_Click
            Call loadViewSettings
        Case 3
            mnuViewClassicTheme_Click
            Call loadViewSettings
    End Select
End With

If command <> vbNullString Then
    Dim argv() As String
    Dim i As Integer
    Dim strMap As String
    Dim doExit As Boolean
    Dim doJoin As Boolean
    
    argv = ParseCommandLine()
    For i = 0 To UBound(argv())
      MsgBox ("arg" & i & ": " & argv(i))
      Select Case argv(i)
        Case "/s", "-s" 'Specify Server
            If UBound(argv()) >= i + 1 And (Left(argv(i + 1), 1) <> "/") And (Left(argv(i + 1), 1) <> "-") Then
                strServer(0) = argv(i + 1)
                i = i + 1
            End If
                        
        Case "/e", "-e" 'Join/Enter IP or Name
            strIPAddress = argv(i + 1)
            'name joining not implemented yet
            If UBound(argv()) >= i + 1 And (Left(argv(i + 1), 1) <> "/") And (Left(argv(i + 1), 1) <> "-") Then
                If argv(i + 1) = "" Then
                strIPAddress = "127.0.0.1"
                'if valid name
                'if valid game id
                'if valid ip
                'else dont join
                Else: strIPAddress = argv(i + 1)
                End If
                i = i + 1
            End If
            doJoin = True
            
        Case "/c", "-c" 'Open Create Game dialog (optional: pre select map)
            strMap = ""
            If UBound(argv()) >= i + 1 And (Left(argv(i + 1), 1) <> "/") And (Left(argv(i + 1), 1) <> "-") Then
                strMap = argv(i + 1)
                i = i + 1
            End If
             
            If strMap <> "" Then
            With cR
                .ClassKey = HKEY_CURRENT_USER
                .SectionKey = "SOFTWARE\GTA2 Game Hunter"
                .ValueKey = "MapDesc"
                .ValueType = REG_SZ
                .Value = strMap
            End With
            End If
            
            cmdHost_Click
            
        Case "/h", "-h" 'Host Game with Map
            If UBound(argv()) >= i + 1 And (Left(argv(i + 1), 1) <> "/") And (Left(argv(i), 1 + 1) <> "-") Then
                strMap = argv(i + 1)
                i = i + 1
            End If
            
            MsgBox (strMap)
            'unlike in /c the maps is not applyed successfully here
            
            If strMap <> "" Then
            With cR
                .ClassKey = HKEY_CURRENT_USER
                .SectionKey = "SOFTWARE\GTA2 Game Hunter"
                .ValueKey = "MapDesc"
                .ValueType = REG_SZ
                .Value = strMap
            End With
            End If
            
            blnHosted = True
            If frmGH.PreHost = False Then Exit Sub
            Call frmGH.Host
            
            Call SendMessage(lngHandleStart, BM_CLICK, 0, 0)
            'active = Activate 'error
            
            
        Case "/p", "-p" 'Singleplayer
            If UBound(argv()) >= i + 1 And (Left(argv(i + 1), 1) <> "/") And (Left(argv(i), 1 + 1) <> "-") Then
                strMap = argv(i + 1)
                i = i + 1
            End If
            
            If strMap <> "" Then
            With cR
                .ClassKey = HKEY_CURRENT_USER
                .SectionKey = "SOFTWARE\GTA2 Game Hunter"
                .ValueKey = "MapDesc"
                .ValueType = REG_SZ
                .Value = strMap
            End With
            End If
            
            frmCreateGame.cmdPlayAlone_Click 'no effect
            'active = Activate 'error
                        
        Case "/d", "-d" 'Download Maps
            Do While UBound(argv()) >= i + 1 And (Left(argv(i + 1), 1) <> "/") And (Left(argv(i + 1), 1) <> "-")
                Call CopyURLToFile(argv(i + 1), GetTmpPath & "gta2map.7z")
                i = i + 1
            Loop
            
        Case "/j", "-j" 'Join Channel
            Do While UBound(argv()) >= i + 1 And (Left(argv(i + 1), 1) <> "/") And (Left(argv(i + 1), 1) <> "-")
                'join channels not implemented yet
                i = i + 1
            Loop
            
        Case "/q", "-q" 'Exit gh
            doExit = True
            
        Case "/i", "-i" 'Don't open new instance
            If App.PrevInstance = True Then
                'pass parameters not implemented
                doExit = True
            End If
                       
        Case "/l", "-l" 'No Sign in
            blnchkConnectOnStartup = False
                      
        Case "/h", "-h", "--h", "/?", "-?", "/help", "-help", "--help"
            blnchkConnectOnStartup = False
            Call displayCommands
            
      End Select
    Next i
    
    If doExit = True Then cmdExit_Click
    'If doJoin = True Then lvGames_click (0)

    'Sektor old Code ----------------------------
    'strIPAddress = command
    ''intIPAddress = command
    ''If Right(command, 1) = "/" Then intIPAddress = Mid(command, 1, Len(command) - 1)
    ''If LCase(Left(command, 7)) = "gta2://" Then intIPAddress = Mid(intIPAddress, 8, 255)
    'blnCommand = True
    'cmdJoin_Click
    'cmdExit_Click
    '------------------------------------
End If

If blnchkConnectOnStartup = True Then cmdConnect_click

'Dim SharingMgr, EachConnection, ConnectionProps, item
'    Set SharingMgr = CreateObject("HNetCfg.HNetShare.1")  '1

'    displaychat strDestTab, vbRed, "The following network adapters were detected:"
'    For Each item In SharingMgr.EnumEveryConnection          '2
'        Set EachConnection = SharingMgr.INetSharingConfigurationForINetConnection(item) '3
'        Set ConnectionProps = SharingMgr.NetConnectionProps(item)   '4
'        displaychat strDestTab, vbRed, vbNullString & ConnectionProps.Name
'        'If EachConnection.InternetFirewallEnabled = True Then
'        '    displaychat strDestTab, vbRed, "Windows firewall is enabled: " & ConnectionProps.Name
'        'Else
'        '    displaychat strDestTab, vbRed, "Windows firewall is disabled: " & ConnectionProps.Name
'        'End If
'    Next
    
    Exit Sub
oops:
    If Err.Number <> 429 Then
        If blnchkConnectOnStartup = True Then cmdConnect_click
    Else
        displaychat strDestTab, vbRed, "Error during startup:" & Err.Description & " " & Err.Number & " Line: " & Erl
    End If
End Sub

Public Sub getCC()
On Error GoTo oops:
    sckURL.Close
    'sckURL.Connect "api.hostip.info", 80
    sckURL.Connect "geoloc.daiguo.com", 80
    'http://api.hostip.info/country.php
    'sckURL.Connect "gtamp.com", 80
    'sckURL.Connect "www.maxmind.com"  'www.maxmind.com/app/mylocation
    'sckURL.Connect "127.0.0.1", 80
    Exit Sub
oops:
displaychat strChannel, strGHColor, "Error connecting to " & TXT_GEOSITE
End Sub

Private Sub cmdExit_Click()
    'save settings to registry on exit
    Save_Click
    Call saveChannels
    With cR
        .SectionKey = "SOFTWARE\GTA2 Game Hunter\display"
        .ValueKey = "Theme"
        .Value = intTheme
        .ValueKey = "lvGames(0).SortKey"
        .Value = lvGames(0).SortKey
        .ValueKey = "lvGames(0).SortOrder"
        .Value = lvGames(0).SortOrder
        .ValueKey = "lvPlayers(0).SortKey"
        .Value = lvPlayers(0).SortKey
        .ValueKey = "lvPlayers(0).SortOrder"
        .Value = lvPlayers(0).SortOrder

        ''''save the Widths of all columns in ListView lvGames(0) (left)
        '''(Removed 2010-10-28.)
        
        'Save window size and position:
        .ValueKey = "WindowState"
        .Value = WindowState
        If .Value <> "2" Then
            .ValueKey = "Height"
            .ValueType = REG_SZ
            .Value = Height
            
            .ValueKey = "Width"
            .ValueType = REG_SZ
            .Value = Width
            
            .ValueKey = "Left"
            .ValueType = REG_SZ
            .Value = Left
            
            .ValueKey = "Top"
            .ValueType = REG_SZ
            .Value = Top
        End If
        .ClassKey = HKEY_CURRENT_USER
        .SectionKey = "Software\DMA Design Ltd\GTA2\Debug\"
        .ValueKey = "bob_debug_display"
        .ValueType = REG_DWORD
        .Value = 1
        .ValueKey = "do_blood"
        .ValueType = REG_DWORD
        .Value = 1
        .ValueKey = "do_debug_keys"
        .ValueType = REG_DWORD
        .Value = 1
        
        .ValueKey = "skip_mission"
        If .Value <> vbNullString Then .DeleteValue
        .ValueKey = "skip_frontend"
        If .Value <> vbNullString Then .DeleteValue
        .ValueKey = "play_replay"
        If .Value <> vbNullString Then .DeleteValue
    End With
    RemoveSystray 'removes the icon from the systray

'    Dim frm As Form
'    For Each frm In Forms
'        Unload frm
'    Next
    End
End Sub

Public Function PreHost() As Boolean
On Error GoTo oops
    
    If strGTA2path = "\\" Or strGTA2path = "\" Or strGTA2path = "/" Then
        strGTA2path = " "
    Else
        If Right$(strGTA2path, 1) <> "\" Then strGTA2path = strGTA2path & "\"
    End If
    
    PreHost = True
    
    If Exists(strGTA2path & TXT_GTA2EXE) = False Then
        Dim strTemp As String
        strTemp = BrowseFile(strGTA2path & TXT_GTA2EXE)
        If strTemp = vbNullString Or Len(strTemp) < Len(TXT_GTA2EXE) Then
            PreHost = False
            Exit Function
        Else
            strGTA2path = Left$(strTemp, Len(strTemp) - Len(TXT_GTA2EXE))
        End If
    End If
    
    If DetectGTA2version = False Then Exit Function
    
    Call MoveMMPfiles 'moves MMP files from tempMMP to data and then removes tempMMP folder
    AddDescriptionAndFileToListView 'lvMMPlist
    
    'add all map descriptions from lvMMPlist to cSortArray (sorted array)
    Dim i As Integer
    Set SortedArray = Nothing
    
    For i = 1 To frmGH.lvMMPlist.ListItems.count
        SortedArray.AddItem LCase(Trim(frmGH.lvMMPlist.ListItems.Item(i).ListSubItems(4))) 'add map description to array (trim and convert to lcase)
    Next i
    
    'clear current IP address from registry to stop GTA2 from trying to scan anyone
    'before the Create Game button is clicked
    strIPAddress = "127.0.0.1" 'vbNullString
    Dim cR As New cRegistry
    With cR
        .ClassKey = HKEY_CURRENT_USER
        .SectionKey = "Software\DMA Design Ltd\GTA2\Network\"
        .ValueKey = "TCPIPAddrStringd"
        If LenB(.Value) > 0 Then .DeleteValue
        .ValueKey = "TCPIPAddrStrings"
        If LenB(.Value) > 0 Then .DeleteValue
    End With

    Save_Click
Exit Function
oops:
strErrLine = Erl
strErrdesc = Err.Description
displaychat strDestTab, strTextColor, "Error during PreHost: " & strErrdesc & ", Line: " & strErrLine
send "PRIVMSG " & gta2ghbot & " :Error during PreHost function: " & strErrdesc & " " & strErrLine
End Function

Public Sub cmdHost_Click()
    Dim strTemp As String
    Static lngStaticCount As Long
    Dim lngCount As Long
    
    If blnCreateGameLoaded = False Then
        If PreHost = False Then Exit Sub
        frmCreateGame.loadDisplaySettings
        frmCreateGame.loadFilterSettings
        blnCreateGameLoaded = True
    End If
    
    'Count the number of MMP files
    strTemp = Dir(strGTA2path & "data\*.mmp", vbHidden + vbNormal + vbSystem + vbReadOnly + vbArchive)
    Do While strTemp <> vbNullString
        strTemp = Dir
        lngCount = lngCount + 1
    Loop
    
    'If the number of MMP files has changed from last time then refresh the list
    If lngCount <> lngStaticCount Then
        Call frmCreateGame.cmdRefresh_Click
        lngStaticCount = lngCount
    End If
    
    frmCreateGame.txtFind.Text = vbNullString
    frmCreateGame.Show
    Call giveFocus(frmCreateGame.lvMaps)
   
    Exit Sub
oops:
    strErrdesc = Err.Description
    strErrLine = Erl
    displaychat strDestTab, vbRed, "Error hosting: " & strErrdesc
    send "PRIVMSG " & gta2ghbot & " :Error hosting: " & strErrdesc & " Line: " & strErrLine
End Sub

Public Sub Host()
On Error GoTo oops:
    Dim strReplay As String
    Call AudioFileCheck
    If IsGTA2running() = True Then Exit Sub
    If DetectGTA2version = False Then Exit Sub
  
    displaychat strChannel, strGHColor, "Launching GTA2" '& strGTA2path & TXT_GTA2EXE & " -n -c"
    modMkDir strGTA2path & "test"
    
    If blnPlayReplay = True Then
        If Exists(strGTA2path & "test\replay.rep") Then strReplay = " -r"
    End If
    
    'Call ShellExecute(Me.hwnd, "Open", strGTA2path & TXT_GTA2EXE, "-n -c" & strReplay, strGTA2path, vbNormalFocus)
    blnInGame = False
    lngPID = shellandwait(strGTA2path & TXT_GTA2EXE & " -n -c" & strReplay, strGTA2path)
    
    blnHosted = True
    
    If blnConnected = False Then
        displaychat strDestTab, strGHColor, "Sign in to publically advertise your game."
    End If
    
    Call SetPlayerName
    
Exit Sub
oops:
 strErrLine = Erl
 strErrdesc = Err.Description
 displaychat strDestTab, strTextColor, "Error during host function: " & strErrdesc & ", Line: " & strErrLine
 send "PRIVMSG " & gta2ghbot & " :Error during host function: " & strErrdesc & " " & strErrLine
End Sub

Public Sub SetPlayerName()
    With cR
        .ClassKey = HKEY_CURRENT_USER
        .SectionKey = "Software\DMA Design Ltd\GTA2\Network"
        .ValueKey = "PlayerName"
        If .Value = vbNullString Then
            .ValueType = REG_SZ
            .Value = strNick
        End If
    End With
End Sub

Public Function IsGTA2running() As Boolean
    IsGTA2running = False
    
    Call FindProcess(TXT_GTA2EXE, True) 'Find and kill process
'        IsGTA2running = True
'        Select Case MsgBox("GTA2 is already open.  Terminate process?", vbYesNo Or vbQuestion Or vbDefaultButton1, "Terminate GTA2")
'            Case vbYes
'                IsGTA2running = False
'                Call FindProcess(TXT_GTA2EXE, True) 'Find and kill process
'            Case vbNo
'                IsGTA2running = True
'                Exit Function
'        End Select
'    End If
End Function

Public Sub cmdJoin_Click()
    On Error GoTo oops

    If Exists(strGTA2path & TXT_GTA2EXE) = False Then Exit Sub

    Save_Click
    If strGTA2path = "\\" Or strGTA2path = "\" Or strGTA2path = "/" Then
        strGTA2path = vbNullString
    Else
        If Right$(strGTA2path, 1) <> "\" Then strGTA2path = strGTA2path & "\"
    End If
    
    If DetectGTA2version = False Then Exit Sub
    
    Call SetPlayerName 'if playername is blank then change it to IRC nick
    modMkDir strGTA2path & "test"
    If blnPlayReplay = True Then
        blnPlayReplay = False
        Dim strPlayReplay As String
        strPlayReplay = " -r"
    End If
    displaychat strChannel, strGHColor, "Launching " & strGTA2path & TXT_GTA2EXE & " -n -j" & strPlayReplay
    'Call ShellExecute(Me.hwnd, "Open", strGTA2path & TXT_GTA2EXE, "-n -j" & strPlayReplay, strGTA2path, vbNormalFocus)
    blnInGame = False
    lngPID = shellandwait(strGTA2path & TXT_GTA2EXE & " -n -j" & strPlayReplay, strGTA2path)
Exit Sub
oops:
    strErrdesc = Err.Description
    strErrLine = Erl
If Err.Number = 5 Then
    displaychat strDestTab, strTextColor, "Unable to launch GTA2."
    send "PRIVMSG " & gta2ghbot & " :Launch failure"
Else
    displaychat strDestTab, strTextColor, "Error joining: " & strErrdesc
    send "PRIVMSG " & gta2ghbot & " :Error joining: " & strErrdesc & " " & strErrLine
End If

End Sub

Private Sub Save_Click()
    Dim i As Integer
    Dim j As Integer
    On Error GoTo oops
    Dim byteIPAddress() As Byte

    With cR
        'gta2 game hunter settings
        .ClassKey = HKEY_CURRENT_USER
        .SectionKey = "SOFTWARE\GTA2 Game Hunter"
        .ValueKey = "GTA2folder"
        .ValueType = REG_SZ
        If Len(strGTA2path) > 0 Then
            .Value = strGTA2path
        End If
        .ValueKey = "GHfolder"
        .ValueType = REG_SZ
        .Value = App.Path

        'HKEY_CURRENT_USER\Control Panel\Accessibility\StickyKeys
        'displaychat strDestTab, vbRed, "Writing registry key HKEY_CURRENT_USER\Control Panel\Accessibility\StickyKeys\Flags: new value = 26"

        .ClassKey = HKEY_CURRENT_USER
        .SectionKey = "Control Panel\Accessibility\StickyKeys"
        .ValueKey = "Flags"
        .ValueType = REG_SZ
        .Value = 26

        .ClassKey = HKEY_CURRENT_USER
        .SectionKey = "Software\DMA Design Ltd\GTA2\Network"

        'if game time limit < 5 then set it to unlimited
        .ValueKey = "game_time_limit"
        If .Value < 5 Then
            .ValueType = REG_DWORD
            .Value = 0
        End If

        'if no frag limit
        .ValueKey = "f_limit"
        If LenB(.Value) = 0 Then
            .ValueType = REG_DWORD
            .Value = 10
        End If

        'if no protocol is selected then select 0
        .ValueKey = "protocol_selected"
        If LenB(.Value) = 0 Then
            .ValueType = REG_DWORD
            .Value = 0
        End If

        'store IP address in byte array
        byteIPAddress = strIPAddress & vbNullChar & vbNullChar 'add two nulls to the end
        ' Store IP Address in registy as hex
        .ValueKey = "TCPIPAddrStringd"
        .ValueType = REG_BINARY
        .Value = byteIPAddress() 'add IP address array to registry

        .ValueKey = "TCPIPAddrStrings" 'this key stores the length of the IP
        .ValueType = REG_DWORD
        .Value = Len(strIPAddress) * 2 + 2 '*2 and then add 2, to include nulls in length

        Dim eek() As Byte
        .ValueKey = "UseConnectiond"

        Dim strUseConnectiond As String
        j = 0

        byteIPAddress = strIPAddress
        strUseConnectiond = "60f518132c91d0119daa00a0c90a43cb04000000FF000000c016d907afe0cf119c4e00a0c905425e10000000e05ee9367785cf11960c0080c7534e82a03232e6bf9dd0119cc100a0c905425e" & UBound(byteIPAddress)
        If Len(strIPAddress) < 51 Then
          strUseConnectiond = strUseConnectiond & ".."
        Else
          strUseConnectiond = strUseConnectiond & "."
        End If
        ReDim eek(Len(strUseConnectiond) / 2 + Len(strIPAddress) * 2 + 5) As Byte
        For i = 1 To 152 Step 2
            eek(j) = CByte("&H" & Mid(strUseConnectiond, i, 2))
            j = j + 1
        Next i

        eek(20) = CByte("&H" & Hex(Len(strUseConnectiond) / 2 + Len(strIPAddress) * 2 + 4))
        eek(76) = CByte("&H" & Hex(Len(strIPAddress) * 2 + 2))

        For i = 0 To UBound(byteIPAddress)
            eek(80 + i) = byteIPAddress(i)
        Next i

        .ValueType = REG_BINARY
        .Value = eek()

        'UseConnectionS
        .ValueKey = "UseConnections" 'this key stores the length of the IP
        .ValueType = REG_DWORD
        i = eek(20)
        .Value = i
        Erase eek()
        strUseConnectiond = vbNullString

        ReDim eek(15) As Byte
        .ValueKey = "UseProtocold"
        If LenB(.Value) = 0 Then 'if the data is empty
            .ValueType = REG_BINARY
            .ValueKey = "UseProtocold"
            Dim UseProtocold As String
            j = 0
            UseProtocold = "e05ee9367785cf11960c0080c7534e82"
            For i = 1 To 32 Step 2
                eek(j) = CByte("&H" & Mid(UseProtocold, i, 2))
                j = j + 1
            Next i
            .Value = eek()
            Erase eek()
            ReDim eek(0) As Byte
            UseProtocold = vbNullString
        End If

        .ValueKey = "UseProtocols"
        If LenB(.Value) = 0 Then 'if the data is empty
            .ValueType = REG_DWORD
            .Value = 16
        End If
        
    End With
    
    Exit Sub
oops:
    strErrLine = Erl
    strErrdesc = Err.Description
    Call MsgBox("GTA2 needs write access to HKEY_CURRENT_USER\Software\DMA Design Ltd\GTA2" _
                    & vbNewLine & "Try logging in as administrator to fix the problem, you know the password right?" _
                    & vbNewLine & "Error writing to registry: " & strErrdesc & " - Line: " & strErrLine _
                    , vbExclamation, "GTA2 Game Hunter - error writing to registry")
    'send "PRIVMSG " & gta2ghbot & " :Error writing to registry: " & strErrdesc
End Sub

Private Sub mnuViewGridlines_Click()
    Dim i As Integer
    mnuViewGridlines.Checked = Not mnuViewGridlines.Checked
    
    With cR
        .ClassKey = HKEY_CURRENT_USER
        .SectionKey = "SOFTWARE\GTA2 Game Hunter"
        .ValueKey = "Gridlines"
        .ValueType = REG_DWORD
        If mnuViewGridlines.Checked = True Then
            .Value = 1
        Else
            .Value = 0
        End If
            
        frmGH.lvGames(0).GridLines = mnuViewGridlines.Checked
        
        For i = 0 To frmGH.lvPlayers.UBound
            frmGH.lvPlayers(i).GridLines = mnuViewGridlines.Checked
        Next
    End With
End Sub

Private Sub mnuViewTimestamp_Click()
    blnchkTime = Not blnchkTime
    mnuViewTimestamp.Checked = blnchkTime
    
    With cR
        .ClassKey = HKEY_CURRENT_USER
        .SectionKey = "SOFTWARE\GTA2 Game Hunter"
        .ValueKey = "chkTimestamp"
        .ValueType = REG_DWORD
        If blnchkTime = True Then
            .Value = 1
        Else
            .Value = 0
        End If
    End With
End Sub

Private Sub mnuFileExit_Click()
    cmdExit_Click
End Sub

Private Sub mnuHelpAbout_Click()
    frmAbout.about
End Sub

Private Sub cmdChat_Click()
On Error GoTo oops
   
rtbChatbox(0).SelColor = strTextColor

Dim i As Integer
Dim intChatbox As Integer

intChatbox = -1

For i = 0 To rtbChatbox.UBound
    If LCase(rtbChatbox(i).Tag) = LCase(tabIRC.SelectedItem) Then
        intChatbox = i
        Exit For
    End If
Next

If intChatbox = -1 Then Exit Sub
If rtbChatbox(intChatbox).Text = vbNullString Then Exit Sub

' /msg
Dim strChatMsg As String
Dim strChatCommand As String 'cmdX is all chars up to the first space
Dim strChatParam As String 'The first chat parameter, usually a channel
Dim strChatParam2 As String
Dim strChatExcludingCommand As String 'Chat message excluding "/command "
Dim bytFirstSpaceLoc As Byte
'Dim intFirstSpaceLoc As Integer
'Dim intFirstNotSpaceLoc As Integer
'Dim intSecondSpaceLoc As Integer

strChatMsg = Trim(rtbChatbox(intChatbox).Text)  'remove all leading and trailing spaces from msg and store in strChatMsg

If strChatMsg = vbNullString Then Exit Sub    'if there's no message exit the sub

If Left$(strChatMsg, 1) <> "/" Then 'if the message doesn't begin with a / then send it to the channel
    send "PRIVMSG " & tabIRC.SelectedItem.Caption & " :" & strChatMsg 'send the message to the active channel/nick
    If blnConnected Then displaychat tabIRC.SelectedItem.Caption, strTextColor, "<" & strNick & "> " & strChatMsg  'display the message"
Else
    'Msg is a command because it begins with a /
    bytFirstSpaceLoc = InStr(1, strChatMsg, " ")  'Location of the first space character in the msg
    If bytFirstSpaceLoc = 0 Then
        strChatCommand = strChatMsg
    Else
        strChatExcludingCommand = Mid$(strChatMsg, bytFirstSpaceLoc + 1, 666)
        strChatCommand = Left$(strChatMsg, bytFirstSpaceLoc - 1) 'cmdX is all chars up to the first space
    End If
    
    strChatCommand = UCase$(Right$(strChatCommand, Len(strChatCommand) - 1)) 'Strip off the / and convert to uppercase

    'The parameters start when there are no more space characters
    If bytFirstSpaceLoc > 0 Then
        Do Until Mid$(strChatMsg, bytFirstSpaceLoc, 1) <> " " Or bytFirstSpaceLoc = 255
            bytFirstSpaceLoc = bytFirstSpaceLoc + 1
        Loop
        
        intLinePosition = bytFirstSpaceLoc
        Call AddChar(intLinePosition, strChatMsg, strChatParam)
    End If

Select Case strChatCommand
  Case "K", "KICK"
        send "KICK " & strChannel & Right$(strChatMsg, Len(strChatMsg) - Len(strChatCommand) - 1)
  Case "RAWW"
      send Right$(strChatMsg, Len(strChatMsg) - 6)
  Case "ME", "ACTION"
      If strChatParam = vbNullString Then Exit Sub
      send "PRIVMSG " & tabIRC.SelectedItem.Caption & " :" & "ACTION " & Right$(strChatMsg, Len(strChatMsg) - bytFirstSpaceLoc + 1) & ""
      displaychat tabIRC.SelectedItem.Caption, strActionColor, strNick & " " & Right$(strChatMsg, Len(strChatMsg) - bytFirstSpaceLoc + 1)
  Case "CLEAR", "CLS"
      rtbHistory(intChatbox).Text = vbNullString
  Case "DNS", "D"
      displaychat strDestTab, strConnectionColor, "Trying to resolve " & strChatParam
      Dim strIPFromHostName As String
      strIPFromHostName = GetIPFromHostName(strChatParam)
      If strIPFromHostName = vbNullString Then
          displaychat strDestTab, strConnectionColor, "Unable to resolve " & strChatParam
      Else
          displaychat strDestTab, strConnectionColor, "Resolved " & strChatParam & " to " & strIPFromHostName
      End If
  Case "ICMP"
        Dim replyInfo As ICMP_ECHO_REPLY
        Dim replyData As Long
        displaychat strDestTab, strConnectionColor, "ping " & strChatParam & " - please wait"
        replyData = ping(strChatParam, replyInfo)
        If replyData = 0 Then
            displaychat strDestTab, strConnectionColor, EvaluatePingResponse(replyData) & " in " & replyInfo.RoundTripTime & " ms"
  Else:
            displaychat strDestTab, strConnectionColor, EvaluatePingResponse(replyData)
        End If
  Case "AWAY", "A"
        Call toggleAwayStatus(strChatExcludingCommand)
  Case "BACK", "B"
        Call back
        Call changeStatus(strStatusMsg)
  Case "MSG", "M"
      Do Until Mid$(strChatMsg, intLinePosition) <> " " Or bytFirstSpaceLoc = 255
          intLinePosition = intLinePosition + 1
      Loop
      If strChatParam = vbNullString Then Exit Sub
      If Len(strChatMsg) + 1 = intLinePosition Then Exit Sub
      strChatParam2 = Trim(Right$(strChatMsg, Len(strChatMsg) - intLinePosition))
        'only send a message if the user is on the same channel as you
        If onYourChannel(strChatParam) = False Then
            displaychat tabIRC.SelectedItem.Caption, strGHColor, "You must be in the same channel as " & strChatParam & " to send them a message."
            Exit Sub
        End If
      
      send "PRIVMSG " & strChatParam & " :" & strChatParam2
      displaychat tabIRC.SelectedItem.Caption, strTextColor, "-> *" & strChatParam & "* " & strChatParam2
  Case "QUERY", "Q"
      displaychat strChatParam, strTextColor, vbNullString
  Case "HOST", "IP"
      displaychat strDestTab, strConnectionColor, "Your external host name is: " & strExternalHostName
  Case "QUIT", "EXIT"
      send "QUIT :" & Mid$(strChatMsg, 7, 255)
      'blnDONOTCHANGESERVER = True
      blnDisconnectClick = True
      Disconnect
  Case "HIDE"
      blnHidden = Not blnHidden
      
      If blnHidden = True Then
          With cR
              .ClassKey = HKEY_CURRENT_USER
              .SectionKey = "software\gta2 game hunter"
              .ValueKey = "Hide"
              .Value = 1
          End With
      
          'send "mode " & strNick & " +x"
          send "hs on"
          displaychat strDestTab, strGHColor, "Host hidden"
      Else
          With cR
              .ClassKey = HKEY_CURRENT_USER
              .SectionKey = "software\gta2 game hunter"
              .ValueKey = "Hide"
              .Value = 0
          End With
      
          'send "mode " & strNick & " -x"
          send "hs off"
          displaychat strDestTab, strGHColor, "Host visible"
      End If
  'Case "FONT", "F"
  '   Call displayDialogFont("History")
  'Case "CC"
  '    Call updateCountry(strChatParam, "GH",intDestTab)
  'Case "L"
  '    displaychat strDestTab, strGHColor, "Listening on port " & frmProbeGTA2.Socket(0).LocalPort
  Case "T", "TERMINATE"
      Call FindProcess(TXT_GTA2EXE, True) 'Find and kill process
      Call FindProcess("dplaysvr.exe", True) 'Find and kill process
  Case "KILL", "PSKILL", "TASKKILL"
      If strChatParam = vbNullString Then
        displaychat strChannel, strGHColor, "/kill needs an executable name"
      Else
        Call FindProcess(strChatParam, True)
      End If
  Case "GET"
       Call CopyURLToFile(strChatParam, GetTmpPath & "gta2map.7z")
  Case "WHOIS", "W", "WI", "WII"
      'name is sent twice so it works on players who are on different linked servers (IRC oddity)
      send "WHOIS " & strChatParam & " " & strChatParam
  Case "/", "?", "H", "HELP", "NOTICE", "SETNAME"
      Call displayCommands
  Case "J", "JOIN"
      send "JOIN " & strChatExcludingCommand
  Case "P", "PART"
      If strChatExcludingCommand = vbNullString Then strChatExcludingCommand = tabIRC.SelectedItem
      If strChatExcludingCommand <> strChannel Then
        For i = 1 To tabIRC.Tabs.count
            If tabIRC.Tabs(i).Caption = strChatExcludingCommand Then
                tabIRC.Tabs(i).Selected = True
                send "PART " & strChatExcludingCommand
                Call form_KeyDown(vbKeyW, vbCtrlMask)
                Exit For
            End If
        Next i
      End If
  Case "HOP", "CYCLE"
        send "CYCLE " & tabIRC.SelectedItem.Caption & " " & strChatParam
  Case "E"
      blnHosted = True
      If frmGH.PreHost = False Then Exit Sub
      Call frmGH.Host 'ehost
  Case "C"
      blnHosted = True
      If frmGH.PreHost = False Then Exit Sub
      Call frmGH.Host
  Case "R"
      mnuToolsSize_Click (0)
'  Case "CRCALL"
'        Dim oFileSystem As New FileSystemObject
'        Dim oFolder As Folder
'        Dim oCurrentFile As File
'        Dim oFileColl As Files
'
'        Set oFolder = oFileSystem.GetFolder(strGTA2path & "data\")
'        Set oFileColl = oFolder.Files
'
'
'        If oFileSystem.FolderExists(oFolder) = False Then Exit Sub
'
'        'Move all files in gta2\data\tempMMP to gta2\data
'        If oFileColl.count > 0 Then
'            For Each oCurrentFile In oFileColl
'                Open "c:\temp\" & LCase(oCurrentFile.Name) & ".crc" For Output As #1
'                Print #1, calc_crc32(strGTA2path & "data\" & oCurrentFile.Name)
'                Close #1
'            Next
'        End If
'
'        Set oFileSystem = Nothing
'        Set oFolder = Nothing
'        Set oFileColl = Nothing
'        Set oCurrentFile = Nothing
'
  Case "CRC32", "CRC"
      If strChatParam = vbNullString Then Exit Sub
      strChatParam2 = calc_crc32(strChatExcludingCommand)
      If strChatParam2 = "00000000" Then
        displaychat strDestTab, strGHColor, "File not Found " & strChatExcludingCommand
      Else
        displaychat strDestTab, strGHColor, strChatExcludingCommand & " CRC32 " & strChatParam2
      End If
  Case "RUN"
      If strChatParam = vbNullString Then Exit Sub
      If ShellExecute(Me.hwnd, "Open", strChatExcludingCommand, vbNullString, Mid$(strChatExcludingCommand, 1, InStrRev(strChatExcludingCommand, "\")), vbNormalFocus) = 2 Then
        displaychat strDestTab, strGHColor, "Failed to run " & strChatExcludingCommand
      End If
  Case "RAWHIDE"
        displaychat strChannel, strGHColor, strRaw
'  Case "CTCP"
'      i = InStr(1, strChatExcludingCommand, " ")
'      If i Then
'            strChatParam2 = Mid$(strChatExcludingCommand, i + 1, 666)
'            send "PRIVMSG " & strChatParam & " " & Chr$(1) & UCase$(strChatParam2) & Chr$(1)
'      End If
  Case "TOPIC"
        If strChatParam = vbNullString Then Exit Sub
        If Left$(strChatParam, 1) = "#" Then
            If InStr(strChatExcludingCommand, " ") Then
                send "TOPIC " & strChatExcludingCommand
            Else
                Exit Sub
            End If
        Else
            send "TOPIC " & tabIRC.SelectedItem.Caption & "  " & strChatExcludingCommand
        End If
  Case Else
      send Mid$(strChatMsg, 2, 666)
End Select

End If

rtbChatbox(intChatbox).Text = vbNullString    'clear the field
'Add code to scroll to bottom if you send a message

Exit Sub

oops:
strErrdesc = Err.Description
strErrLine = Erl
displaychat strDestTab, vbRed, "Error during Chat_Click(): " & strErrdesc & " - Line: " & strErrLine
send "PRIVMSG " & gta2ghbot & " :Error during Chat_Click(): " & strErrdesc & " - Line: " & strErrLine
End Sub

Private Sub displayCommands()
strDestTab = frmGH.tabIRC.SelectedItem 'display in current tab
displaychat strDestTab, strHelpColor, vbNullString
displaychat strDestTab, strHelpColor, "Commands, controls and help:"
displaychat strDestTab, strHelpColor, "Private message: /msg GTA2Guy What's the password?"
displaychat strDestTab, strHelpColor, "Set your status to away: /away ran away from home"
displaychat strDestTab, strHelpColor, "Set your status to normal: /back"
displaychat strDestTab, strHelpColor, "Say you are doing something: /me shot the food!"
displaychat strDestTab, strHelpColor, "View player details: /wi GTA2Guy"
displaychat strDestTab, strHelpColor, "Get an IP from a hostname: /dns GTAMP.com"
displaychat strDestTab, strHelpColor, "Ping an IP through icmp (like if you do in start>cmd): /icmp 192.168.1.17"
displaychat strDestTab, strHelpColor, "Clear the currently selected chat history: /clear or /cls"
displaychat strDestTab, strHelpColor, "Quickly create a game: /c"
displaychat strDestTab, strHelpColor, "Set GH resolution to 640x480: /r"
displaychat strDestTab, strHelpColor, "Exit with a quit message: /quit I regret nothing!"
displaychat strDestTab, strHelpColor, "Part channel: /p or /part or /p #channelname"
displaychat strDestTab, strHelpColor, "Rejoin channel: /hop or /cycle"
displaychat strDestTab, strHelpColor, "Close all processes named gta2.exe and dplaysvr.exe: /t"
displaychat strDestTab, strHelpColor, "Close all processes named notepad: /kill notepad"
displaychat strDestTab, strHelpColor, "Display CRC32 of a file: /crc gta2.exe"
displaychat strDestTab, strHelpColor, "ctrl+w to hide the current tab"
displaychat strDestTab, strHelpColor, "ctrl+F4 to close all tabs"
displaychat strDestTab, strHelpColor, "ctrl/alt + a number from 1 to 9 switches chat tab from 1 to 9"
displaychat strDestTab, strHelpColor, "alt+right or ctrl+tab switches chat tab to the right"
displaychat strDestTab, strHelpColor, "alt+left or ctrl+shift+tab switches chat tab to the left"
displaychat strDestTab, strHelpColor, "F10 to chat in GTA2"

displaychat strDestTab, strHelpColor, vbNullString
displaychat strDestTab, strHelpColor, "Commandline arguments of gta2gh.exe: (also works with / instead of -)"
displaychat strDestTab, strHelpColor, "[-s ip]: Let gh join a different irc server"
displaychat strDestTab, strHelpColor, "[-e [host]]: Join. Automatically joins a game. No argument: join lan game, ID: join game #x, IP: join IP, username: join user"
displaychat strDestTab, strHelpColor, "[-c [map]]: Open Create Game dialog and select a map if specified"
displaychat strDestTab, strHelpColor, "[-h [map]]: Host last played map if no map is specified"
displaychat strDestTab, strHelpColor, "[-p [map]]: Play specified map in single player mode"
displaychat strDestTab, strHelpColor, "[-d [[url1] [url2] [url3] [...]]: Install specified maps"
displaychat strDestTab, strHelpColor, "[-j [[channel1] [channel2] [channel3] [...]]: Install specified maps"
displaychat strDestTab, strHelpColor, "[-q]: exit gh (after doing tasks)"
displaychat strDestTab, strHelpColor, "[-i]: don't open a new instance"
displaychat strDestTab, strHelpColor, "[-l]: do not sign in"
displaychat strDestTab, strHelpColor, "[-?]: display this help"

displaychat strDestTab, strHelpColor, vbNullString
displaychat strDestTab, strHelpColor, "http://gtamp.com/GTA2/changelog.txt http://gtamp.com/GTA2/todo.txt http://gtamp.com/gh"
displaychat strDestTab, strHelpColor, "Temporary storage folder: " & GetTmpPath
Call GetMACs_AdaptInfo
End Sub

Public Sub cmdDisconnect_Click()
    blnPrivmsg = False
    If sockIRC.State = sckConnected Then send "QUIT :signed out" 'send the quit message
    displaychat strDestTab, strConnectionColor, "Disconnected"
    blnConnected = False
    blnLogin = False
    sockIRC.Close
    blnDisconnectClick = True
    Disconnect
End Sub
Public Sub Disconnect()
    lvPlayers(0).ListItems.Clear
    lvGames(0).ListItems.Clear
    timTimeout.Enabled = False
    blnLogin = False
    cmdConnect.Enabled = True
    mnuFileSignIn.Enabled = True
End Sub

Private Sub list_of_games(ByVal lstGames As String, ByVal intGameListIndex As Integer) '- join click
On Error GoTo oops:
    Dim i As Integer
    Dim strHostMap As String
    Dim strHostMMP As String
    Dim strHostGMP As String
    Dim strHostSTY As String
    Dim strHostSCR As String
    Dim strHostGHver As String
    
    If tabIRC.SelectedItem.Index <> 1 Then tabIRC.Tabs.Item(1).Selected = True
    
    If lvGames(0).ListItems.count >= intGameListIndex Then
      If lvGames(0).ListItems.Item(intGameListIndex).ListSubItems.count = 7 Then
        strHostCommentLastJoined = lstGames & ": " & lvGames(0).ListItems.Item(intGameListIndex).ListSubItems.Item(7)
      End If
    Else
      displaychat strChannel, strGHColor, "Try again."
    End If

    'check if host is in user list
    blnItemInList = False
    
    For i = 1 To lvPlayers(0).ListItems.count
        Dim strFirstCharName As String
        strFirstCharName = Left$(lvPlayers(0).ListItems.Item(i), 1)
        
        Select Case strFirstCharName
'            Case "@", "+", "~", "&", "%"
'                If lstGames = Mid$(lvPlayers(0).ListItems.Item(i), 2, 255) Then
'                    blnItemInList = True
'                    Exit For
'                End If
            Case Else
                If lstGames = lvPlayers(0).ListItems.Item(i) Then
                    blnItemInList = True
                    Exit For
                End If
        End Select
    Next i

    Call AudioFileCheck

    If lstGames = strNick Then
        frmGameSettings.main
        Exit Sub
    End If
    
    If lngPID <> 0 And FindProcess(TXT_GTA2EXE, , lngPID) = True Then
        displaychat strChannel, strGHColor, "Close GTA2 before trying to join a game."
        Exit Sub
    End If
   
    Call DetectGTA2version

    If intGameListIndex > lvGames(0).ListItems.count Then
      displaychat strChannel, strTextColor, "Unable to join: Game number " & intGameListIndex & " does not exist.  Try again."
      Exit Sub
    End If

    strMMPfile = lvGames(0).ListItems.Item(intGameListIndex).ListSubItems(3).ToolTipText
    If strMMPfile = vbNullString Then
        displaychat strChannel, strGHColor, "Unable to detect the map filename used by " & lstGames
        Exit Sub
    End If
    
    strHostMMP = lvGames(0).ListItems.Item(intGameListIndex).ListSubItems(3).ToolTipText & ".mmp"
    strHostMap = lvGames(0).ListItems.Item(intGameListIndex).ListSubItems(3).Text
    
    If lvGames(0).ListItems.Item(intGameListIndex).ListSubItems(4).ToolTipText = "Play Replay" Then
        blnPlayReplay = True
    Else
        blnPlayReplay = False
    End If
    
    If Exists(strGTA2path & "data\" & strHostMMP) = False Then
            If blnchkAutoDownload = True Then
                displaychat strChannel, strGHColor, "You don't have " & strMMPfile & ". I will try to download it."
                Call CopyURLToFile("http://gtamp.com/maps/" & LCase(strMMPfile), GetTmpPath & "gta2map.7z")
            Else
                displaychat strChannel, strGHColor, "Try to download map this map from http://gtamp.com/maps/" & LCase(strMMPfile) & " or http://gta2dare.omnitude.net/maplist/download.php?mmp=" & Replace(LCase(strMMPfile), " ", "%20") & ".mmp"
            End If
        Exit Sub
    End If
        
    Dim strMMPfullpath As String
    strMMPfullpath = strGTA2path & "data\" & strHostMMP
    With lvGames(0).ListItems.Item(intGameListIndex).ListSubItems(3)
        .Text = readINI("MapFiles", "Description", strMMPfullpath)
    End With
    strHostGMP = readINI("MapFiles", "GMPFile", strMMPfullpath)
    strHostSTY = readINI("MapFiles", "STYFile", strMMPfullpath)
    strHostSCR = readINI("MapFiles", "SCRFile", strMMPfullpath)
    strExecutableChecksum = calc_crc32(strGTA2path & TXT_GTA2EXE)
    strMapChecksum = calc_crc32(strGTA2path & "data\" & strHostGMP)
    strScriptChecksum = calc_crc32(strGTA2path & "data\" & strHostSCR)
  
    strHostNick = lstGames
    
    strHostGHver = lvGames(0).ListItems.Item(intGameListIndex).ListSubItems(4)
    If strHostGHver < "1.513" Then strMMPfile = vbNullString
    
    'Ask for password if game is locked
    If lvGames(0).ListItems.Item(intGameListIndex).ListSubItems(1) = "Yes" Then
        If strHostGHver < "1.513" Then
            displaychat strChannel, strGHColor, "Ask the host to update GH."
        Else
            frmPassword.main (lstGames)
        End If
    Else
        send "NOTICE " & lstGames & " " & "J" & strExecutableChecksum & strMapChecksum & _
            strScriptChecksum & strMMPfile
        displaychat strChannel, strGHColor, "Asking to join " & lstGames
    End If
    
    Exit Sub
oops:
    strErrdesc = Err.Description
    strErrLine = Erl
    displaychat strDestTab, vbRed, "Error while trying to join: " & strErrdesc & " - Line: " & strErrLine
    send "PRIVMSG " & gta2ghbot & " :Error while trying to join: " & strErrdesc & " - Line: " & strErrLine
End Sub

'Private Sub lvPlayers_click(index As Integer)
Private Sub lvPlayers_MouseUp(Index As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single)

On Error GoTo oops
    
Dim blnFoundPlayer As Boolean
Dim strPlayerName As String
Dim i As Integer
Dim j As Integer
Dim intrtbHistory As Integer

'If GetAsyncKeyState(VK_RBUTTON) Then
If Button = vbRightButton Then
    With lvPlayers(Index)
        If .ListItems.count = 0 Then Exit Sub 'if the list is empty then you clicked nothing
        send "WHOIS " & .SelectedItem.Text & " " & .SelectedItem.Text
    End With
    
    For i = 0 To rtbChatbox.UBound
        If rtbChatbox(i).Visible = True Then
            Call giveFocus(frmGH.rtbChatbox(i))
            Exit For
        End If
    Next
    
    Exit Sub
End If

'If GetAsyncKeyState(VK_LBUTTON) Then
'    'do nothing
'Else
'     Exit Sub
'End If

If lvPlayers(Index).ListItems.count = 0 Then Exit Sub 'if the list is empty then you clicked nothing

strPlayerName = lvPlayers(Index).SelectedItem.Text

'Strip operator codes from player name. There are some other codes used on certain IRC networks.
'I should parse the PREFIX IRC server response to get the real operator codes
Select Case Left$(strPlayerName, 1)
    Case "@", "+", "~", "&", "%"
        strPlayerName = Mid$(strPlayerName, 2, 255)
End Select

'''Did the player click themselves?
If strPlayerName = strNick Then
    '''Toggle status
    Call toggleAwayStatus
    Exit Sub '''done!
End If

Call hideWindows

'search the tabs for the player name
For i = 1 To frmGH.tabIRC.Tabs.count
    If UCase$(frmGH.tabIRC.Tabs.Item(i).Caption) = UCase$(strPlayerName) Then
        blnFoundPlayer = True
        Exit For
    End If
Next i

'search the chathistory array for the player name
For j = 1 To frmGH.rtbHistory.UBound
    If LCase$(frmGH.rtbHistory(j).Tag) = LCase$(strPlayerName) Then
        frmGH.rtbHistory(j).Visible = True
        frmGH.rtbChatbox(j).Visible = True
        frmGH.rtbHistory(j).Visible = True
        
        If blnFoundPlayer = False Then
            blnFoundPlayer = True
            frmGH.tabIRC.Tabs.Add , , strPlayerName
            i = frmGH.tabIRC.Tabs.count
        End If
        
        intrtbHistory = j
        Exit For
    End If
Next j
    
'add a new tab if player wasn't found
If blnFoundPlayer = False Then
    frmGH.tabIRC.Tabs.Add , , strPlayerName
    i = frmGH.tabIRC.Tabs.count
    Load frmGH.rtbHistory(frmGH.rtbHistory.UBound + 1)
    Load frmGH.rtbChatbox(frmGH.rtbChatbox.UBound + 1)
    Load frmGH.rtbTopic(frmGH.rtbTopic.UBound + 1)
    frmGH.rtbTopic(frmGH.rtbTopic.UBound).Text = TXT_PRIVATE & strPlayerName
    frmGH.rtbTopic(frmGH.rtbTopic.UBound).Tag = strPlayerName
    frmGH.rtbTopic(frmGH.rtbTopic.UBound).Locked = True
    frmGH.rtbHistory(frmGH.rtbHistory.UBound).Text = vbNullString
    frmGH.rtbHistory(frmGH.rtbHistory.UBound).Tag = strPlayerName
    '''EnableAutoURLDetection frmGH.rtbHistory(frmGH.rtbHistory.ubound)
    intrtbHistory = frmGH.rtbHistory.UBound
    
    With frmGH.rtbChatbox(frmGH.rtbChatbox.UBound)
        .Tag = strPlayerName
        .Text = vbNullString
        .SelStart = 0
        .SelLength = 500
        .SelColor = strTextColor
        .SelLength = 0
    End With
End If
    
'make the tab active
tabIRC.Tabs.Item(i).Selected = True
Call giveFocus(rtbChatbox(intrtbHistory))
rtbChatbox(intrtbHistory).Width = ScaleWidth
rtbHistory(intrtbHistory).Width = lvGames(0).Width
rtbTopic(intrtbHistory).Width = lvGames(0).Width

Exit Sub

oops:
    strErrdesc = Err.Description
    strErrLine = Erl
    displaychat strDestTab, vbRed, "Player list error: " & Err.Description & " Line: " & strErrLine
End Sub

Private Sub lvGames_MouseUp(Index As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single)
    If Button = vbRightButton Then
        With lvGames(Index)
            If .ListItems.count = 0 Then Exit Sub 'if the list is empty then you clicked nothing
            send "WHOIS " & .SelectedItem.Text & " " & .SelectedItem.Text
        End With
        Exit Sub
    End If
    
    If Button = vbLeftButton Then
        If lvGames(Index).ListItems.count = 0 Then Exit Sub 'if the list is empty then you clicked nothing
    
        If Exists(strGTA2path & TXT_GTA2EXE) = False Then
            displaychat strDestTab, vbRed, "Can't find " & strGTA2path & TXT_GTA2EXE
            Dim strTemp As String
            strTemp = BrowseFile(strGTA2path & TXT_GTA2EXE)
            If Len(strTemp) <= Len(TXT_GTA2EXE) Then
                Exit Sub
            Else
                strGTA2path = Left$(strTemp, Len(strTemp) - Len(TXT_GTA2EXE))
            End If
        End If
    
        Call DetectGTA2version
    
        If Val(strGTA2version) < 11 Then
            Exit Sub
        End If
        
        With lvGames(Index)
            Call list_of_games(.SelectedItem.Text, .SelectedItem.Index)
        End With
    End If

Exit Sub

oops:
    strErrdesc = Err.Description
    strErrLine = Erl
    displaychat strDestTab, vbRed, "Game list error: " & Err.Description & " Line: " & strErrLine
End Sub


'Private Sub lvGames_click(index As Integer)
'On Error GoTo oops
'
'If GetAsyncKeyState(VK_RBUTTON) Then
'    With lvGames(index)
'        If .ListItems.count = 0 Then Exit Sub 'if the list is empty then you clicked nothing
'        send "WHOIS " & .SelectedItem.Text & " " & .SelectedItem.Text
'    End With
'    Exit Sub
'End If
'
'If GetAsyncKeyState(VK_LBUTTON) Then
'    'do nothing
'Else
'     Exit Sub
'End If
'
'If lvGames(index).ListItems.count = 0 Then Exit Sub 'if the list is empty then you clicked nothing
'
'If Exists(strGTA2path & TXT_GTA2EXE) = False Then
'    displaychat strDestTab, vbRed, "Can't find " & strGTA2path & TXT_GTA2EXE
'    Dim strTemp As String
'    strTemp = BrowseFile(strGTA2path & TXT_GTA2EXE)
'    If Len(strTemp) <= Len(TXT_GTA2EXE) Then
'        Exit Sub
'    Else
'        strGTA2path = Left$(strTemp, Len(strTemp) - Len(TXT_GTA2EXE))
'    End If
'End If
'
'Call DetectGTA2version
'
'If Val(strGTA2version) < 11 Then
'    Exit Sub
'End If
'
'With lvGames(index)
'    Call list_of_games(.SelectedItem.Text, .SelectedItem.index)
'End With
'
'Exit Sub
'
'oops:
'    strErrdesc = Err.Description
'    strErrLine = Erl
'    displaychat strDestTab, vbRed, "Game list error: " & Err.Description & " Line: " & strErrLine
'End Sub

Private Sub mnuViewHighlight_Click()
    With cR
        .ClassKey = HKEY_CURRENT_USER
        .SectionKey = "SOFTWARE\GTA2 Game Hunter"
        .ValueType = REG_DWORD
        .ValueKey = "chkHighlight"
        
        If mnuViewHighlight.Checked = True Then
            mnuViewHighlight.Checked = False
            .Value = 0
        Else
            mnuViewHighlight.Checked = True
            .Value = 1
        End If
        
        blnHighlight = .Value
    End With
End Sub

Private Sub sckURL_Connect()
On Error Resume Next
    'If strFailedCountryIP = vbNullString Then
      'http://api.hostip.info/country.php
      'sckURL.SendData "GET /country.php HTTP/1.0" & vbCrLf
      'sckURL.SendData "Host: api.hostip.info" & vbCrLf
      'sckURL.SendData vbCrLf
      
      sckURL.SendData "GET /?self HTTP/1.0" & vbCrLf
      sckURL.SendData "Host: geoloc.daiguo.com" & vbCrLf
      sckURL.SendData vbCrLf
      '    Else
      '      sckURL.SendData "GET /?ip=" & strFailedCountryIP & " HTTP/1.0" & vbCrLf
      '      sckURL.SendData "Host: geoloc.daiguo.com" & vbCrLf
      '      sckURL.SendData vbCrLf
    'End If
End Sub

Private Sub sckURL_DataArrival(ByVal BytesTotal As Long)
On Error GoTo oops
    Dim strTemp As String
    Dim i As Integer
    Dim strTempCC As String
    
    If sckURL.State = sckConnected Then sckURL.GetData strTemp, vbString, 666
    
    'strTempCC = Right$(strTemp, 2)
    
    'search the response for 1; and the next two characters should be the country code
    i = InStr(strTemp, "1;")
    
    If i = 0 Then
        displaychat strDestTab, strConnectionColor, TXT_COUNTRY_DETECTION_FAILED
        sckURL.Close
        blnCountryDetectFail = True
        Exit Sub
    End If
        
    If i > 0 Then strTempCC = Mid$(strTemp, i + 2, 2)
      
    sckURL.Close
      
    Select Case strTempCC
        Case "GB"
            strTempCC = "UK"
        Case "EU"
            blnCountryDetectFail = True
    End Select
    
    For i = 0 To UBound(strCountries)
        If strTempCC = Right$(strCountries(i), 2) Then
            If blnCountryDetectFail = False Then
                displaychat strDestTab, strConnectionColor, vbNullString & "Country detected as " & Left$(strCountries(i), Len(strCountries(i)) - 5)
            End If
            
            strCountryCode = strTempCC
            intCountryIndex = i
            
            With cR
                .ClassKey = HKEY_CURRENT_USER
                .SectionKey = "SOFTWARE\GTA2 Game Hunter"
                .ValueType = REG_SZ
                .ValueKey = "Country"
                .Value = strCountryCode
            End With
            Exit For
        End If
    Next i
    Exit Sub
oops:
    displaychat strChannel, strGHColor, "sckURL_DataArrival error"
End Sub

Private Sub sckURL_error(ByVal Number As Integer, Description As String, ByVal sCode As Long, ByVal Source As String, ByVal HelpFile As String, ByVal HelpContext As Long, CancelDisplay As Boolean)
    displaychat strDestTab, strConnectionColor, TXT_COUNTRY_DETECTION_FAILED & ": " & Description
    displaychat strDestTab, strConnectionColor, "Failed to connect to: " & TXT_GEOSITE
    If blnBot = True Then Exit Sub
    cmdConnect.Enabled = True
    mnuFileSignIn.Enabled = True
    blnCountryDetectFail = True
End Sub

Private Sub sockIRC_Connect()   'as soon as we're connected to the server:
    Dim strIdent As String
    blnConnected = True    'set connected to true (cancel the timeout procedure)
    blnConnectClick = False
    
    If strPassword = vbNullString Then strPassword = "x"
    send "PASS " & strPassword
    send "NICK " & strPreferedNick 'send the nick message
    'USER <username> <hostname> <servername> <real name>
    If strCountryCode = vbNullString Then strCountryCode = "??"
    Call GetMACs_AdaptInfo
    strIdent = strMacAddress
    If strIdent = vbNullString Then strIdent = strPreferedNick
    send "USER " & strIdent & " " & sockIRC.LocalIP & _
        " GTA2GameHunter :GH" & TXT_GHVER & strCountryCode
End Sub

Private Sub sockIRC_error(ByVal Number As Integer, Description As String, ByVal sCode As Long, ByVal Source As String, ByVal HelpFile As String, ByVal HelpContext As Long, CancelDisplay As Boolean)
    'If Description = "Connection is forcefully rejected" Then
        Select Case Number
            Case "11001", "11004"
                displaychat strDestTab, strConnectionColor, "Failed to resolve host: " & strServer(0)
            Case "10061"
                displaychat strDestTab, strConnectionColor, "Unable to connect to server"
            Case Else
                displaychat strDestTab, strConnectionColor, Number & " " & Description
        End Select
        blnDisconnectClick = False
        timTimeout.Enabled = False
        sockIRC.Close
        'Call changeServer
        Call Disconnect
        If intServerNum = 1 Then
            blnReconnect = True
        Else
            Call Reconnect
        End If
    'End If
End Sub

Private Sub sockIRC_DataArrival(ByVal BytesTotal As Long)
On Error GoTo oops
    Dim X As Long
    For X& = 1 To BytesTotal    'get every byte we received, but only one at a time
        Dim strTemp As String   'this variable will be used to store one byte of data
        If sockIRC.State = sckConnected Then sockIRC.GetData strTemp, vbString, 1  'get 1 byte out of the data stream and store it in strTemp
        If strTemp = Chr$(10) Then    'if we received a newline character (this is the end of the message)
            processCommand  'process the entire command
            strData = vbNullString      'clear the strData
        End If
        'bug
        If strTemp <> vbNullString Then
            If Not (Asc(strTemp) = 10 Or Asc(strTemp) = 13) Then strData = strData & strTemp
        End If
            'if we received a newline character or a carriage return, dont add them to the message
    Next

    Exit Sub

oops:
    strErrdesc = Err.Description
    strErrLine = Erl
    displaychat strDestTab, strTextColor, "error during data arrival: " & strErrLine & " " & strErrdesc
    send "PRIVMSG " & gta2ghbot & " :DA" & strErrLine & " " & Erl
    cmdDisconnect_Click
End Sub

Private Sub tabIRC_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = vbRightButton And Left$(tabIRC.SelectedItem, 1) <> "#" Then
    send "WHOIS " & tabIRC.SelectedItem.Caption & " " & tabIRC.SelectedItem.Caption
End If
End Sub

Private Sub tabIRC_Click()
    On Error GoTo oops:
    Dim i As Integer
    Dim intChatHistory As Integer
    Dim intPlayerList As Integer
    intPlayerList = -1
    intChatHistory = -1
      
    If tabIRC.SelectedItem.Index = 1 Then
        cmdX.Enabled = False
    Else
        cmdX.Enabled = True
    End If
     
    Call hideWindows
        
    Dim intTopicIndex As Integer
    Dim intChatHistoryIndex As Integer
    Dim intChatboxIndex As Integer

    For i = 0 To rtbTopic.UBound
        If LCase(tabIRC.SelectedItem.Caption) = LCase(rtbTopic(i).Tag) Then
            intTopicIndex = i
            intChatboxIndex = i
            intChatHistoryIndex = i
            Exit For
        End If
    Next
    
'    For i = 0 To rtbHistory.UBound
'        If tabIRC.SelectedItem.Caption = rtbHistory(i).Tag Then
'            intChatHistoryIndex = i
'            Exit For
'        End If
'    Next
'
'    For i = 0 To rtbChatbox.UBound
'        If tabIRC.SelectedItem.Caption = rtbChatbox(i).Tag Then
'            intChatboxIndex = i
'            Exit For
'        End If
'    Next
    
    rtbHistory(intChatHistoryIndex).Visible = True
    rtbChatbox(intChatboxIndex).Visible = True
    rtbTopic(intTopicIndex).Visible = True
    
    For i = 0 To rtbHistory.UBound
        If rtbHistory(i).Tag = tabIRC.SelectedItem.Caption Then intChatHistory = i
    Next i
    
    If intChatHistory = -1 Then
        Exit Sub
    End If
    
    For i = 0 To lvPlayers.UBound
        If lvPlayers(i).Visible = True Then lvPlayers(i).Visible = False
    Next i
        
    rtbChatbox(intChatHistory).Visible = True
    Call giveFocus(rtbChatbox(intChatHistory))
    tabIRC.Tabs.Item(tabIRC.SelectedItem.Index).HighLighted = False
    
    rtbHistory(intChatHistory).Visible = True
    With rtbTopic(intChatHistory)
        .Visible = True
        .Width = rtbHistory(0).Width
        .Top = rtbTopic(0).Top
        .Height = rtbTopic(0).Height
    End With
    
    If InStr(tabIRC.SelectedItem.Caption, "#") = 0 Then
        lvPlayers(0).Visible = True 'remove this line to hide player list in private chat
        rtbTopic(intChatHistory).Text = TXT_PRIVATE & tabIRC.SelectedItem.Caption
    Else
        intPlayerList = getPlayerLV(tabIRC.SelectedItem.Caption)
        lvPlayers(intPlayerList).Visible = True
        
        For i = 1 To lvPlayers(intPlayerList).ListItems.count
            If UCase$(tabIRC.SelectedItem.Caption) = UCase$(lvPlayers(intPlayerList).ListItems(i).Text) Then
                lvPlayers(intPlayerList).ListItems.Item(i).Selected = True
                Exit For
            End If
        Next i
    End If
    
    Call Form_Resize
    Exit Sub
oops:
    strErrdesc = Err.Description
    strErrLine = Erl
    displaychat strDestTab, strTextColor, "error during tabIRC: " & strErrLine & " " & strErrdesc
    send "PRIVMSG " & gta2ghbot & " :error during tabIRC " & strErrLine & " " & strErrdesc & " TabCount: " & tabIRC.Tabs.count & " Tab: " & i
End Sub

Private Sub timTimeout_Timer()
    If Not (blnConnected) Then
        displaychat strDestTab, strConnectionColor, "The connection to the server timed out"
        blnDisconnectClick = False
        timTimeout.Enabled = False
        sockIRC.Close
        'Call changeServer
        Call Disconnect
        Reconnect
    End If
End Sub

'Public Sub changeServer()
'    If InStr(strServer(0), "127.0.0.1") Then Exit Sub
'    If blnDONOTCHANGESERVER = True Then
'        blnDONOTCHANGESERVER = False
'        Exit Sub
'    End If
'    intServerNum = intServerNum + 1
'    If intServerNum > UBound(strServer) Then intServerNum = 0
'    If strServer(intServerNum) = vbNullString Then intServerNum = 0
'    displaychat strDestTab, strConnectionColor, "Server changed to: " & strServer(intServerNum)
'End Sub

'keeps checking to see if host has changed map by reading map_index
Private Sub timUpdateMap_Timer()
Dim i As Long

On Error GoTo oops

If blnReadyForJoiners = False Then Exit Sub

'Read map index from registry
With cR
    .ClassKey = HKEY_CURRENT_USER
    .SectionKey = "Software\DMA Design Ltd\GTA2\Network"
    .ValueKey = "map_index"
    i = .Value
End With

If i >= SortedArray.count Then i = 0

If intPreviousMapIndex <> i Then
    If SortedArray.count > 0 Then strGTA2MapDesc = SortedArray.SortedItem(i)
    intPreviousMapIndex = i
End If

Call AdvertiseHostedGame

Exit Sub
oops:
    strErrdesc = Err.Description
    strErrLine = Erl
    displaychat strDestTab, strTextColor, "error during timUpdateMap: " & strErrLine & " " & strErrdesc
    send "PRIVMSG " & gta2ghbot & " :error during timUpdateMap: " & strErrLine & " " & strErrdesc

End Sub

Private Sub rtbTopic_change(Index As Integer)
On Error GoTo oops:

''Remove any styling from Drag & Drop:
Dim strTemp As String, lngSelStart As Long, lngSelLength As Long 'store state

'Restore the text without its formatting:
With rtbTopic(Index)
    'Store:
    lngSelStart = .SelStart
    lngSelLength = .SelLength
    strTemp = .Text

    'Clear:
    .TextRTF = vbNullString

    'Restore:
    .Text = strTemp
    .SelStart = 0
    .SelLength = 9999
    
    'highlight URLs
    Dim strArray() As String
    Dim i As Integer
    Dim j As Integer
 
    strArray = Split(strTemp)
    
    For i = 0 To UBound(strArray)
        
        If isURL(strArray(i)) = True Then
            .SelStart = j
            .SelLength = Len(strArray(i))
            .SelColor = vbBlue
            .SelUnderline = True
            .SelBold = blnFontBold
            .SelItalic = blnFontItalic
            .SelFontName = strFontName
            .SelText = .SelText
        End If
        
        j = j + Len(strArray(i)) + 1
    Next
    
    .SelColor = strTextColor
    .SelStart = lngSelStart
    .SelLength = lngSelLength
    
End With

Exit Sub
oops:
    strErrdesc = Err.Description
    strErrLine = Erl
    displaychat strDestTab, strTextColor, "error during topic change: " & strErrLine & " " & strErrdesc
    send "PRIVMSG " & gta2ghbot & " :topic_change: " & strErrLine & " " & strErrdesc
End Sub

Private Sub rtbChatbox_change(Index As Integer)
''Remove any styling from Drag & Drop:
Dim strTemp As String, lngSelStart As Long, lngSelLength As Long 'store state
'Restore the text without its formatting:
With rtbChatbox(Index)
    'Store:
    lngSelStart = .SelStart
    lngSelLength = .SelLength
    strTemp = .Text

    'Clear:
    .TextRTF = vbNullString

    'Restore:
    .Text = strTemp
    .SelStart = 0
    .SelLength = 9999
    .SelColor = strTextColor
    .SelStart = lngSelStart
    .SelLength = lngSelLength
    
End With

End Sub

'Private Sub rtbChatbox_KeyDown(Index As Integer, KeyCode As Integer, Shift As Integer)
'On Error GoTo oops
''
''Key Code Constants: http://msdn.microsoft.com/en-us/library/aa243025(VS.60).aspx
'Select Case KeyCode
''Case vbKeyUp
''    If intChatboxHistoryCurrent > 0 Then
''        intChatboxHistoryCurrent = intChatboxHistoryCurrent - 1
''        If rtbChatbox(Index).Text <> vbNullString And rtbChatbox(Index).Text <> strChatboxHistory(Index, intChatboxHistoryCurrent) Then
''            strChatboxHistory(Index, intChatboxHistoryCount) = rtbChatbox(Index).Text
''        End If
''        rtbChatbox(Index).Text = strChatboxHistory(Index, intChatboxHistoryCurrent)
''        rtbChatbox(Index).SelStart = 0
''        rtbChatbox(Index).SelLength = 500
''        rtbChatbox(Index).SelColor = strTextColor
''        rtbChatbox(Index).SelLength = 0
''    End If
''Case vbKeyDown
''    If intChatboxHistoryCurrent < intChatboxHistoryCount And rtbChatbox(Index) <> vbNullString Then
''        intChatboxHistoryCurrent = intChatboxHistoryCurrent + 1
''        rtbChatbox(Index).Text = strChatboxHistory(Index, intChatboxHistoryCurrent)
''        rtbChatbox(Index).SelStart = 0
''        rtbChatbox(Index).SelLength = 500
''        rtbChatbox(Index).SelColor = strTextColor
''        rtbChatbox(Index).SelLength = 0
''    End If
''
''Ctrl key:
'
'
'Exit Sub
'oops:
'    strErrdesc = Err.Description
'    strErrLine = Erl
'    displaychat strDestTab, strTextColor, "error during keydown: " & strErrLine & " " & strErrdesc
'    send "PRIVMSG " & gta2ghbot & " :error during keydown: " & strErrLine & " " & strErrdesc
'End Sub

Private Sub rtbChatbox_KeyPress(Index As Integer, KeyAscii As Integer)

    Select Case KeyAscii
        Case "13" 'enter
            If Left$(tabIRC.SelectedItem.Caption, 1) <> "#" Then
                'only send a message if the user is on the same channel as you
                If onYourChannel(tabIRC.SelectedItem.Caption) = False Then
                    displaychat tabIRC.SelectedItem.Caption, strGHColor, "You must be in the same channel as " & tabIRC.SelectedItem.Caption & " to send them a message."
                    Exit Sub
                End If
            End If
            cmdChat_Click
            KeyAscii = 0
    End Select
'Messages sent to gtanet can only be around 450 characters
'        'If Len(rtbChatbox(0).Text) > 450 Then KeyAscii = 0
End Sub

Private Sub rtbTopic_KeyPress(Index As Integer, KeyAscii As Integer)

    Select Case KeyAscii
        Case "13" 'enter
            send "TOPIC " & rtbTopic(Index).Tag & " :" & rtbTopic(Index).Text
            KeyAscii = 0
    End Select
'Messages sent to gtanet can only be around 450 characters
'        'If Len(rtbChatbox(0).Text) > 450 Then KeyAscii = 0
End Sub


Private Sub Form_Resize()
  On Error GoTo oops:
    Dim i As Integer
    
    If WindowState <> vbMinimized Then intPrevWinState = WindowState
    
    Dim intPlayerList As Integer
    
    Select Case frmGH.WindowState
        Case vbNormal
            If frmGH.Height < 5000 Then frmGH.Height = 5000
            If frmGH.Width < 8000 Then frmGH.Width = 8000
        Case vbMinimized
            If blnchkMinToTray = True Then
                Hide
                Call Systray
                Exit Sub
            End If
    End Select
 
    If frmGH.Width > 7000 And frmGH.Height > 4000 Then
        If WindowState = vbMaximized Then
            cmdX.Left = ScaleWidth - 370
            'cmdP.Left = ScaleWidth - 770 'Elypter's code
        Else
            cmdX.Left = ScaleWidth - 370
            'cmdP.Left = ScaleWidth - 770 'Elypter's code
        End If
        
        '''Set control positions and sizes:
        Dim intButtonOffset As Integer
        Dim intBannerSpace As Integer
        Dim bannerStyle As Integer
        bannerStyle = 1
                
        intButtonOffset = 0
        imgBanner.Left = 0
        intBannerSpace = 0
                
        If intTheme = 2 Then
            imgBanner.Visible = True
            imgBanner.Height = 795
            If bannerStyle = 2 Then
                intButtonOffset = (ScaleWidth - (5280 + 735)) / 2
                imgBanner.Left = (ScaleWidth - 6750) / 2
                intBannerSpace = imgBanner.Height
            ElseIf bannerStyle = 1 Then
                intButtonOffset = 0
                If frmGH.Width > 13500 Then
                    imgBanner.Visible = True
                    imgBanner.Left = ScaleWidth - imgBanner.Width - 150
                    intBannerSpace = imgBanner.Height - 360
                Else
                    imgBanner.Visible = False
                    intBannerSpace = 0
                End If
            End If
  Else:
            imgBanner.Visible = False
            imgBanner.Height = 0
            intButtonOffset = 0
            imgBanner.Left = 0
        End If
        
        imgBanner.Top = 0
    
        tabIRC.Top = ScaleHeight - tabIRC.Height '- 30 'usually 15 twips per pixel
        tabIRC.Width = ScaleWidth - 900
        lblHide.Top = ScaleHeight - tabIRC.Height '- 30 'usually 15 twips per pixel
        lblHide.Height = tabIRC.Height
        lblHide.Width = 900
        lblHide.Left = ScaleWidth - 900
        
        Dim intTopicIndex As Integer
        Dim intChatHistoryIndex As Integer
        Dim intChatboxIndex As Integer
        
        For i = 0 To rtbTopic.UBound
            If LCase(tabIRC.SelectedItem.Caption) = LCase(rtbTopic(i).Tag) Then
                intTopicIndex = i
                intChatHistoryIndex = i
                intChatboxIndex = i
                Exit For
            End If
        Next
        
        If Left(tabIRC.SelectedItem.Caption, 1) = "#" Then
            intPlayerList = getPlayerLV(tabIRC.SelectedItem.Caption)
        Else
            intPlayerList = 0
        End If
        
            cmdConnect.Left = 0 + intButtonOffset
            cmdHost.Left = 1320 + intButtonOffset
            cmdOptions.Left = 2640 + intButtonOffset
            cmdDisconnect.Left = 3960 + intButtonOffset
            'cmdEnter.Left = 5280 + intButtonOffset 'Elypter's code
            cmdCancel.Left = 6120 + intButtonOffset
            
        
            cmdConnect.Top = 0 + intBannerSpace
            cmdHost.Top = 0 + intBannerSpace
            cmdOptions.Top = 0 + intBannerSpace
            cmdDisconnect.Top = 0 + intBannerSpace
            'cmdEnter.Top = 0 + intBannerSpace 'Elypter's code
            cmdCancel.Top = 0 + intBannerSpace
            lvGames(0).Top = 360 + intBannerSpace
            lvPlayers(intPlayerList).Top = 360 + intBannerSpace
        
            lvPlayers(intPlayerList).Left = ScaleWidth - lvPlayers(intPlayerList).Width
            lvPlayers(intPlayerList).Height = ScaleHeight - 1140 - intBannerSpace
            lvGames(0).Width = lvPlayers(intPlayerList).Left + 10
            rtbTopic(intTopicIndex).Top = lvGames(0).Top + lvGames(0).Height
            rtbTopic(intTopicIndex).Width = lvGames(0).Width
            rtbChatbox(intChatboxIndex).Top = tabIRC.Top - rtbChatbox(intChatboxIndex).Height + 30 'hide top border of tabbed area
            rtbChatbox(intChatboxIndex).Width = ScaleWidth
            rtbHistory(intChatHistoryIndex).Top = rtbTopic(intTopicIndex).Top + rtbTopic(intTopicIndex).Height
            rtbHistory(intChatHistoryIndex).Width = lvGames(0).Width
            rtbHistory(intChatHistoryIndex).Height = rtbChatbox(intChatboxIndex).Top - rtbHistory(intChatHistoryIndex).Top
            If lvPlayers(intPlayerList).ListItems.count Then lvPlayers(intPlayerList).SelectedItem.EnsureVisible

'        Hide player list in private tab
'        Else
'            lvGames(0).Width = ScaleWidth
'            rtbTopic(intTopicIndex).Width = ScaleWidth
'            rtbChatbox(intChatboxIndex).Top = tabIRC.Top - rtbChatbox(intChatboxIndex).Height + 30 'hide top border of tabbed area
'            rtbChatbox(intChatboxIndex).Width = ScaleWidth
'            rtbHistory(intChatHistoryIndex).Top = rtbTopic(intTopicIndex).Top + rtbTopic(intTopicIndex).Height
'            rtbHistory(intChatHistoryIndex).Width = ScaleWidth
'            rtbHistory(intChatHistoryIndex).Height = rtbChatbox(intChatboxIndex).Top - rtbHistory(intChatHistoryIndex).Top
'        End If
    End If
    
    If lvGames(0).ListItems.count Then lvGames(0).SelectedItem.EnsureVisible
    
    'cmdP.Top = tabIRC.Tabs(1).Top + 30 'Elypter's code
    'cmdP.Height = 260 'Elypter's code
    
    cmdX.Top = tabIRC.Tabs(1).Top + 30
    cmdX.Height = 260
    
    Exit Sub
oops:
    strErrdesc = Err.Description
    strErrLine = Erl
    displaychat strDestTab, vbRed, "error during resize: " & strErrdesc & " , line: " & strErrLine
    send "PRIVMSG " & gta2ghbot & " :error during resize: " & strErrdesc & " " & strErrLine
End Sub

Private Sub AutoSizeGames()
On Error GoTo oops
'''Sets the Width of columns in lvGames
'''See "columns.txt" for facts about why and how much padding is needed.
'''Turns out be really fiddly but this sets column Widths perfectly!
'''Print "AutoSizeColumns(" & Index & ")"

'Variables:
Dim sngWidth As Single, sngHeight As Single 'total width of columns, total height of items
Dim strHeader As String, lngValueStart As Long, lngValueEnd As Long 'get count value from 1st column header

'LockWindowUpdate .hwnd

With lvGames(0)
    'Store count displayed by 1st column header:
    strHeader = .ColumnHeaders.Item(1).Text
    lngValueStart = InStr(1, strHeader, "(") + 1
    lngValueEnd = InStr(1, strHeader, ")")
    '''Debug.Prin lngValueStart; lngValueEnd
    If lngValueStart And lngValueEnd Then 'has a value:
        'Is value different from actual count?
        If Mid$(strHeader, lngValueStart, lngValueEnd - lngValueStart) <> .ListItems.count Then
            'Update column header:
            .ColumnHeaders.Item(1).Text = "Games ("
            .ColumnHeaders.Item(1).Text = .ColumnHeaders.Item(1).Text & .ListItems.count & ")" 'count
            ShowListViewColumnHeaderSortIcon lvGames(0) 'restore sorting arrow
        End If
    End If
        
    '''Actual sizing is abstracted to modSizeLV.AutoSizeLV
    sngWidth = AutoSizeLV(lvGames(0))
    
    'Games list changes height to suit number of games
    'No games?
    'txtNoGames.Visible = (.ListItems.count < 1)
    
    'Less than 3 games?
    If .ListItems.count < 3 Then
        sngHeight = 735 '''840 'default
    Else
        'Headers, scrollbar and breathing room:
        sngHeight = (210 * .ListItems.count) + 255 + 60
        '210 for normal row; 255 for headers row; 60 for 3D borders
    End If
    
    'Horizontal scrollbar?
    sngWidth = sngWidth + 60 'add outer borders and padding
    If sngWidth > .Width Then 'horizontal scrollbar
        sngHeight = sngHeight + 255 'space for scrollbar
    End If
    
    'Apply height only if it will be different:
    If .Height <> sngHeight Then 'heights are always Round() due to above
        .Height = sngHeight
        Call Form_Resize 'adapt other controls
    End If

End With

Exit Sub
oops:
    strErrdesc = Err.Description
    strErrLine = Erl
    displaychat strDestTab, strTextColor, "AutoSizeColumns error: Line " & strErrLine & " " & strErrdesc
    send "PRIVMSG " & gta2ghbot & " :AutoSizeColumns error: Line " & strErrLine & " " & strErrdesc
End Sub

Private Sub AutoSizePlayers()
On Error GoTo oops
'''Sets the Width of columns in lvPlayers

'Variables:
Dim sngWidth As Single 'total width of columns
Dim strHeader As String, lngValueStart As Long, lngValueEnd As Long 'get count value from 1st column header
Dim strChannelCaption As String
Dim intPlayerList As String

strChannelCaption = frmGH.tabIRC.SelectedItem.Caption
intPlayerList = getPlayerLV(strChannelCaption)

With lvPlayers(intPlayerList)
    'Store count displayed by 1st column header:
    strHeader = .ColumnHeaders.Item(1).Text
    lngValueStart = InStr(1, strHeader, "(") + 1
    lngValueEnd = InStr(1, strHeader, ")")
    '''Debug.Prin lngValueStart; lngValueEnd
    If lngValueStart And lngValueEnd Then 'has a value:
        'Is value different from actual count?
        If Mid$(strHeader, lngValueStart, lngValueEnd - lngValueStart) <> .ListItems.count Then
            'Update column header:
            .ColumnHeaders.Item(1).Text = "Players ("
            .ColumnHeaders.Item(1).Text = .ColumnHeaders.Item(1).Text & .ListItems.count & ")" 'count
            ShowListViewColumnHeaderSortIcon lvPlayers(intPlayerList) 'restore sorting arrow
        End If
    End If

    '''Actual sizing is abstracted to modSizeLV.AutoSizeLV
    sngWidth = AutoSizeLV(lvPlayers(intPlayerList))
  
    'Players list. If it changes width, other controls adapt to it.
    'Is showing a vertical scrollbar?
    ''''Rebug.Print "Players list: "; .Height; .ListItems.Count; (.ListItems.Count * 210) + 255 + 60
    If .Height < (.ListItems.count * 210) + 255 + 60 Then 'more items than can be shown:
        sngWidth = sngWidth + 255 'typical scrollbar width
    End If
    
    'Apply width only if it will be different:
    sngWidth = sngWidth + 60 'add borders
    If CLng(.Width) <> CLng(sngWidth) Then
        .Width = sngWidth
        Call Form_Resize 'adapt other controls
    End If

End With

Exit Sub
oops:
    strErrdesc = Err.Description
    strErrLine = Erl
    displaychat strDestTab, strTextColor, "AutoSizePlayers error: Line " & strErrLine & " " & strErrdesc
    send "PRIVMSG " & gta2ghbot & " :AutoSizePlayers error: Line " & strErrLine & " " & strErrdesc
End Sub


Private Sub timerStatus_Timer()
    On Error GoTo oops
    Dim strState As String
    Dim i As Integer
    Static lngDownloadTime As Long
    
    If lngDownloadSize <> 0 Then
        lngDownloadTime = lngDownloadTime + 1
        lngSpeed = Int((lngDownloadSize / lngDownloadTime) / 1000)
    Else
        lngDownloadTime = 0
    End If
    
    If blnReconnect = True Then
        intReconnect = intReconnect + 1
        If intReconnect > 3 Then
            intReconnect = 0
            Call Reconnect
            blnReconnect = False
        End If
    End If
    
    If blnReadyForJoiners = False Then Call RemovePlayersGameFromList
    
    'This is used to join the channel after 5 seconds if there is no message from nickserv about the nick being in use
'        If intNickservWaitTime <> -1 Then
'            intNickservWaitTime = intNickservWaitTime + 1
'           If intNickservWaitTime = 5 Then
'               intNickservWaitTime = -1
'               send "JOIN " & strChannel & " " & strKey
'           End If
'       End If
    
    'Some sounds shouldn't play when GH has focus
'    If GetActiveWindow <> 0 Then
'        blnFocus = True
'    Else
'        blnFocus = False
'    End If
    
    If Visible = False And blnSystray = True Then Call Systray 'redraw the systray just in case explorer crashed

    If blnDisconnectClick = False Then
        If intTimeSinceLastServerData > 700 Then
            displaychat strDestTab, vbRed, "Server timed out.  Reconnecting..."
            intTimeSinceLastServerData = 0
            Reconnect
        Else
            intTimeSinceLastServerData = intTimeSinceLastServerData + 1
            If intTimeSinceLastServerData > 200 Then send "userhost " & strNick
        End If
    End If
        
        If blnLogin = True Then
            
            '''Autosize:
            If Visible = True Then
                Call AutoSizeGames
                If Left(tabIRC.SelectedItem.Caption, 1) = "#" Then Call AutoSizePlayers
            End If
            
            If FindProcess("hedgewars") = True Then
                If strStatusMsg <> "=HW" Then
                    changeStatus "=HW"
                    send "NOTICE " & strChannel & " S" & strStatusMsg
                End If
            Else
                If strStatusMsg = "=HW" Then
                    changeStatus vbNullString
                    send "NOTICE " & strChannel & " S"
                End If
            End If
        End If
        
        'is GTA2 running?
        If lngPID <> 0 And FindProcess(TXT_GTA2EXE, , lngPID) = True Then
            If blnInGame = False Then
                Call EnumWindows(AddressOf EnumWindowsProc, 0)
            End If
        Else
            lngWindowHandle = 0
            blnInGame = False
            blnLobby = False
        End If
       
        If blnLobby = False And blnInGame = False Then
            If strStatusMsg <> "A" And strStatusMsg <> "=HW" And strStatusMsg <> vbNullString Then
                send "NOTICE " & strChannel & " S"
                changeStatus (vbNullString)
            End If
        End If

        'Time GTA2 has been in lobby or in game
        If blnLobby = True Then
            lngLobby = lngLobby + 1
            If strStatusMsg = vbNullString And strNickLastJoined <> vbNullString Then
                For i = 1 To frmGH.lvPlayers(0).ListItems.count
                    If frmGH.lvPlayers(0).ListItems.Item(i).Text = strNick Then
                        strStatusMsg = "=" & strNickLastJoined
                        frmGH.lvPlayers(0).ListItems.Item(i).ListSubItems(2) = Left$(strNickLastJoined, 12)
                        frmGH.lvPlayers(0).ListItems.Item(i).ListSubItems(2).ToolTipText = strNickLastJoined
                        send "NOTICE " & strChannel & " S=" & strNickLastJoined
                        strNickLastJoined = vbNullString
                        Exit For
                    End If
                Next i
            End If
        Else
            If lngLobby <> 0 Then
                displaychat strChannel, strGHColor, "GTA2 lobby was open for " & Duration(lngLobby, 2)
                lngLobby = 0
            End If
            
            strPreviousScriptFile = vbNullString
            strPreviousMapFile = vbNullString
            blnReadyForJoiners = False
            blnCalculatedGTA2checksum = False
            
            If blnHosted = True Then
                'set status to GTA2
                If strStatusMsg <> "2" And strStatusMsg <> "A" And strStatusMsg <> "=HW" And blnInGame = True Then
                    strStatusMsg = "2"
                    Call changeStatus(strStatusMsg)
                    send "NOTICE " & strChannel & " :S2"
                End If
                
                Call RemovePlayersGameFromList
                intSecondsWaited = intSecondsWaited + 1

                'if you hosted and GTA2 has been closed for 5 seconds then remove your game
                If intSecondsWaited > 10 Then
                   intSecondsWaited = 0
                   blnHosted = False
                   Call RemovePlayersGameFromList
                End If
            End If
            
            If blnInGame = True Then
                lngGTA2RunningTime = lngGTA2RunningTime + 1
'                If lngGTA2RunningTime > 31536000 Then
'                    lngGTA2RunningTime = 1
'                    MsgBox "WASTE-OF-POWER-BONUS! You left GTA2 open for an entire year!"
'                End If
            Else
                If lngGTA2RunningTime <> 0 Then
                    displaychat strChannel, strGHColor, "GTA2 was in game for " & Duration(lngGTA2RunningTime, 2)
                    lngGTA2RunningTime = 0
                    blnPlayReplay = False
                End If
            End If
        End If
    
    If sockIRC.State = sckClosed Then
        cmdConnect.Enabled = True
        mnuFileSignIn.Enabled = True
    End If
    
    If blnDisconnectClick = False Then
        Select Case sockIRC.State
            Case sckClosed
                strState = "Disconnected"
                Disconnect
                'If blnConnectClick = False Then
                'cmdConnect.Enabled = True
                'mnuFileSignIn.Enabled = True
                'End If
                blnReconnect = True
            Case sckOpen
                strState = "Open"
            Case sckListening
                strState = "Listening"
            Case sckConnectionPending
                strState = "Connection pending"
            Case sckResolvingHost
                strState = "Resolving host"
            Case sckHostResolved
                strState = "Host resolved"
            Case sckConnecting
                strState = "Connecting"
            Case sckConnected
                strState = "Connected"
                blnDisconnect = False
            Case sckClosing
                strState = "Closing"
                cmdDisconnect.Enabled = False
                mnuFileSignOut.Enabled = False
                sockIRC.Close
            Case sckError
                strState = "The server could be down or the host may not be resolving."
                displaychat strDestTab, strConnectionColor, strState
                Call Disconnect
                cmdConnect.Enabled = True
                mnuFileSignIn.Enabled = True
                sockIRC.Close
                blnDisconnectClick = False
                blnReconnect = True
        End Select
        'txtStats = "Useless statistics:" & vbNewline & "Bytes received: " & dblBytesReceived & vbNewline & "Bytes sent: " & dblBytesSent
        'If strState <> strOldState And strState <> "Connected" And strState <> "Connecting" Then displaychat strDestTab, strConnectionColor, "* " & strState & " *"
        strOldState = strState
    End If
    Exit Sub
oops:
    strErrdesc = Err.Description
    strErrLine = Erl

    displaychat strDestTab, strTextColor, "Network status timer error: Line " & strErrLine & " " & strErrdesc
    send "PRIVMSG " & gta2ghbot & " :Network status timer error: Line " & strErrLine & " " & strErrdesc
End Sub

Public Sub Reconnect()
    If blnDisconnectClick = False Then
        If intServerNum = 1 Then
            intServerNum = 0
        Else
            intServerNum = 1
        End If
        cmdConnect_click
    End If
End Sub

Private Sub Form_Initialize()
On Error Resume Next
Const SWP_SHOWWINDOW = &H40
Const SWP_NOMOVE = &H2
Const SWP_NOSIZE = &H1
'only allow one copy of GH to run at a time (can easily be fooled by renaming the exe)
'If App.PrevInstance = True Then 'Or FindProcess("gta2gh.exe", True) Then
'    MsgBox "test"
''    Select Case MsgBox("Found another gta2gh.exe process. Should I stop it? ", vbYesNo Or vbQuestion Or vbDefaultButton1, App.Title)
''        Case vbYes
''            FindProcess "gta2gh.exe", True
''        Case vbNo
'            Dim lngWindow As Long
'            lngWindow = FindWindow(vbNullString, "GTA2 Game Hunter v" & TXT_GHVER)
'            SetWindowPos lngWindow, 0, 0, 0, 0, 0, SWP_SHOWWINDOW + SWP_NOMOVE + SWP_NOSIZE
'            Call OpenIcon(lngWindow)
'            SetForegroundWindow lngWindow
'            End
''    End Select
'End If
'Use the operating system style for XP effects where available:
InitCommonControls 'run the API call

End Sub

Private Sub AudioFileCheck()
On Error GoTo oops
    
    If Exists(strGTA2path & "data\audio\wil.raw") = False Then
        If strGTA2path = vbNullString Then
            displaychat strDestTab, strGHColor, "Where is GTA2 really installed?"
        Else
            displaychat strDestTab, strGHColor, strGTA2path & "data\audio\wil.raw is missing.  Is " & strGTA2path & " your correct GTA2 folder?"
        End If
        
        Dim strTemp As String
        strTemp = BrowseFile(strGTA2path & TXT_GTA2EXE)
        If Len(strTemp) > Len(TXT_GTA2EXE) Then
            strGTA2path = Left$(strTemp, Len(strTemp) - Len(TXT_GTA2EXE))
        End If
    End If
    
    Exit Sub
oops:
    strErrdesc = Err.Description
    displaychat strDestTab, strTextColor, "Error during audio file check: " & strErrdesc
End Sub

Private Sub rtbChatbox_MouseUp(Index As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single)
  ' Show right-click context menu
  If Button = vbRightButton Then
    m_hwndEdit = rtbChatbox(Index).hwnd
    SetEditMenuItemText True
    ' Execution stops here until context menu is hidden.
    ' (TrackPopupMenu() behaves identically!)
    PopupMenu mnuEdit   ' Invokes mnuEdit_Click()
    SetEditMenuItemText False
  End If
End Sub

Private Sub rtbTopic_mouseMove(Index As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single)
    If isURL(RichWordOver(rtbTopic(Index), X, Y)) Then
        SetMouseCursor IDC_HAND
    End If
End Sub

Private Sub rtbHistory_mouseMove(Index As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single)
    If isURL(RichWordOver(rtbHistory(Index), X, Y)) Then
        SetMouseCursor IDC_HAND
    End If

'Debug.Print RichWordOver(rtbHistory(Index), x, y)
'If isURL(RichWordOver(rtbHistory(Index), x, y)) Then
    'Screen.MouseIcon = Me.Icon
    'Screen.MousePointer = 1
    'Screen.MousePointer = 99
'Else
    'Screen.MousePointer = 0
'End If

End Sub

Private Sub rtbHistory_MouseUp(Index As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single)
    
On Error GoTo oops
   
Dim strChar As String

'Show right-click context menu
If Button = vbRightButton Then
    m_hwndEdit = rtbHistory(Index).hwnd
    SetEditMenuItemText True
    ' Execution stops here until context menu is hidden.
    ' (TrackPopupMenu() behaves identically!)
    PopupMenu mnuEdit   ' Invokes mnuEdit_Click()
    SetEditMenuItemText False
    Exit Sub
End If

'This is for Internet URL linking
If Button = vbLeftButton Then  'left click
    If rtbHistory(Index).SelLength > 0 Then Exit Sub
    If rtbHistory(Index).SelStart = Len(rtbHistory(Index).Text) Then Exit Sub
    strChar = Mid$(rtbHistory(Index).Text, rtbHistory(Index).SelStart + 1, 1)
    Select Case strChar
        Case vbCr, vbTab
            Exit Sub
    End Select

    Dim txt As String
    txt = RichWordOver(rtbHistory(Index), X, Y)
    Call urlCheck(txt)
End If
 
Exit Sub

oops:
    strErrdesc = Err.Description
    strErrLine = Erl
    displaychat strDestTab, vbRed, "History URL error: " & strErrdesc
    send "PRIVMSG " & gta2ghbot & " :History URL error: " & strErrdesc & " Line: " & strErrLine
End Sub

Private Sub urlCheck(txt As String)
On Error GoTo oops
Dim ret As Long
Dim strLow As String 'lowercase version of txt
strLow = LCase$(txt)

If isURL(strLow) Then
     
    If blnchkAutoDownload Then
        If Left$(strLow, 22) = "http://gtamp.com/maps/" Then
            If Right$(strLow, 2) = "7z" Or Right$(strLow, 3) = "zip" Or InStr(22, strLow, ".") = 0 Then
                Call CopyURLToFile(txt, GetTmpPath & "gta2map.7z")
                Exit Sub
            End If
        End If
        
        If Left$(strLow, 32) = "http://projectcerbera.com/gta/2/" Then
            If Right$(strLow, 3) = "zip" Or Right$(strLow, 2) = "7z" Then
                Call CopyURLToFile(txt, GetTmpPath & "gta2map.7z")
                Exit Sub
            End If
        End If
        
        If Left$(strLow, 54) = "http://gta2dare.omnitude.net/maplist/download.php?mmp=" Then
            Call CopyURLToFile(txt, GetTmpPath & "gta2map.7z")
            Exit Sub
        End If
        
        If Left$(strLow, 52) = "http://gta2dare.omnitude.net/maplist/autodl.php?mmp=" Then
            Call CopyURLToFile(txt, GetTmpPath & "gta2map.7z")
            Exit Sub
        End If
        
        If Left$(strLow, 37) = "http://gta2dare.omnitude.net/maplump/" Then
            Call CopyURLToFile(txt, GetTmpPath & "gta2map.7z")
            Exit Sub
        End If
    End If
    
    'if this is a URL then start associated browser and goto web site
    ret = ShellExecute(0&, vbNullString, txt, vbNullString, vbNullString, vbNormalFocus)
End If
    
Exit Sub
oops:
    strErrdesc = Err.Description
    strErrLine = Erl
    strErrNum = Err.Number
    displaychat strDestTab, strGHColor, "Error: " & GetTmpPath & "gta2map.7z" & " " & strErrdesc
    send "PRIVMSG " & gta2ghbot & " :urlCheck: " & strErrNum
End Sub

Private Sub rtbTopic_MouseUp(Index As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single)
On Error GoTo oops
    'Show right-click context menu
    If Button = vbRightButton Then
        m_hwndEdit = rtbTopic(Index).hwnd
        SetEditMenuItemText True
        ' Execution stops here until context menu is hidden.
        ' (TrackPopupMenu() behaves identically!)
        PopupMenu mnuEdit   ' Invokes mnuEdit_Click()
        SetEditMenuItemText False
        Exit Sub
    End If
  
    If Button = vbLeftButton Then 'check if left clicked on a URL
        If rtbTopic(Index).SelLength > 0 Then Exit Sub
        If rtbTopic(Index).SelStart = Len(rtbTopic(Index).Text) Then Exit Sub
        Dim txt As String
        txt = RichWordOver(frmGH.rtbTopic(Index), X, Y)
        Call urlCheck(txt)
    End If
   
 Exit Sub

oops:
    strErrdesc = Err.Description
    strErrLine = Erl
    displaychat strDestTab, vbRed, "Topic URL error: " & strErrdesc
    send "PRIVMSG " & gta2ghbot & " :Topic URL error: " & strErrdesc & " Line: " & strErrLine
End Sub

' To change menu command text, this proc must
' be called BEFORE the Edit menu is displayed.
' Will fail miserably if executed when menu IS displayed!!
' Called right before & right after context menu is displayed
' in Form_KeyDown() (Shift+F10) & Rich1_MouseUp()

Private Sub SetEditMenuItemText(bIsContext As Boolean)

  mnuEditUndo.Caption = "&Undo" & IIf(bIsContext, vbNullString, vbTab & "Ctrl+Z")
  mnuEditCut.Caption = "Cu&t" & IIf(bIsContext, vbNullString, vbTab & "Ctrl+X")
  mnuEditCopy.Caption = "&Copy" & IIf(bIsContext, vbNullString, vbTab & "Ctrl+C")
  mnuEditPaste.Caption = "&Paste" & IIf(bIsContext, vbNullString, vbTab & "Ctrl+V")
  mnuEditDelete.Caption = "&Delete" & IIf(bIsContext, vbNullString, vbTab & "Del")
  mnuEditSelAll.Caption = "Select &All" & IIf(bIsContext, vbNullString, vbTab & "Ctrl+A")

End Sub

' >> The Edit menu is already displayed before this code is executed !!! <<

Private Sub mnuEdit_Click()
  EnableEditMenuItems
End Sub

' The Rich ctrl processes edit accelerator keys but does
' not display a corresponding right-click edit context menu (?)
' So NO shortcut keys are defined for the following cmds:
' Undo, Cut, Copy, Paste, Delete & Select All.
' Allows their respective shortcut key strings to be added
' & remove appropriately by mnuEdit_Click() above.
' Their corresponding click events below are called only from
' their respective menu item cmds (not from accelerators).
' The Enabled property is the menu's default property & is either True or False.
' Happens after menu is displayed!

Private Sub EnableEditMenuItems()

  Dim cR As CHARRANGE, dwTxtLen As Long

  ' Fill CR w/ current selection range
  SendMessage m_hwndEdit, EM_EXGETSEL, 0, cR

  ' Disable Paste, Delete & Undo if the read only rtbHistory box has focus
  If m_hwndEdit <> rtbChatbox(tabIRC.SelectedItem.Index - 1).hwnd Then
    mnuEditPaste = False
    mnuEditDelete = False
    mnuEditUndo = False
    mnuEditCut = False
  Else
    ' Paste: enable of clipboard text, disable if not
    mnuEditPaste = Len(Clipboard.GetText)
    ' Undo:
    mnuEditUndo = SendMessage(m_hwndEdit, EM_CANUNDO, 0, 0)
    ' Copy, Delete: enable if a selection, disable if no selection
    mnuEditDelete = (cR.cpMin < cR.cpMax)
    mnuEditCut = (cR.cpMin < cR.cpMax)
  End If

  ' Copy: enable if a selection, disable if no selection
  mnuEditCopy = (cR.cpMin < cR.cpMax)

  ' Select All: disable if everything's already selected, enable otherwise.
  ' The Rich ctrl ALWAYS has a CrLf at the end of it's contents
  ' which is not seen by WM_GETTEXTLENGTH.
  dwTxtLen = SendMessage(m_hwndEdit, WM_GETTEXTLENGTH, 0, 0)
  mnuEditSelAll = Not (cR.cpMin = 0 And cR.cpMax = dwTxtLen + 2&)

'Debug.Prin "TxtLen: "; SendMessage(m_hwndEdit, WM_GETTEXTLENGTH, 0, 0)
'Debug.Prin "CR.cpMin: " & CR.cpMin
'Debug.Prin "CR.cpMax: " & CR.cpMax

End Sub

Private Sub mnuEditUndo_Click()   ' Ctrl+Z
  SendMessage m_hwndEdit, EM_UNDO, 0, 0
End Sub

Private Sub mnuEditCut_Click()   ' Ctrl+X
  SendMessage m_hwndEdit, WM_CUT, 0, 0
End Sub

Private Sub mnuEditCopy_Click()   ' Ctrl+C
  SendMessage m_hwndEdit, WM_COPY, 0, 0
End Sub

Private Sub mnuEditPaste_Click()   ' Ctrl+V
  rtbChatbox(tabIRC.SelectedItem.Index - 1).SelText = rtbChatbox(tabIRC.SelectedItem.Index - 1).SelText & Clipboard.GetText()
  'SendMessage m_hwndEdit, WM_PASTE, 0, 0
End Sub

Private Sub mnuEditDelete_Click()   ' Del
  SendMessage m_hwndEdit, WM_CLEAR, 0, 0
End Sub

Private Sub mnuEditSelAll_Click()   ' Ctrl+A
  Dim cR As CHARRANGE
  cR.cpMin = 0: cR.cpMax = -1
  SendMessage m_hwndEdit, EM_EXSETSEL, 0, cR
End Sub

Private Sub mnuHelpCommands_Click()
Call displayCommands
End Sub

Public Sub RemovePlayersGameFromList()
On Error GoTo oops:
    Dim i As Integer
    
    For i = 1 To lvGames(0).ListItems.count
        If strNick = lvGames(0).ListItems.Item(i) Then
            lvGames(0).ListItems.Remove (i)
            If blnConnected = False Then Exit Sub
            send "NOTICE " & strChannel & " :C"
            If strStatusMsg <> "A" And strStatusMsg <> "=HW" Then changeStatus (vbNullString)
            Exit For
        End If
    Next
    
    Exit Sub
oops:
    strErrdesc = Err.Description
    strErrLine = Erl
    displaychat strDestTab, vbRed, "Error removing your game from list: " & strErrdesc
    send "PRIVMSG " & gta2ghbot & " :Error removing game from list: " & strErrdesc & " Line: " & strErrLine
End Sub

Public Sub AdvertiseHostedGame()
Dim strScriptFile As String
Dim strMapFile As String
Dim strStyleFile As String
Dim i As Integer
Dim intDupeNo As Integer 'The list index number of the duplicate game
Dim strPlayReplay As String

'when hosting add your own game to the list
On Error GoTo oops
'10    On Error Resume Next

    If blnConnected = False Or blnLogin = False Then Exit Sub
    
    Dim blnDuplicateFound As Boolean
    
    With cR
        .ClassKey = HKEY_CURRENT_USER
        .SectionKey = "SOFTWARE\GTA2 Game Hunter"
        .ValueKey = "MapDesc"
        .ValueType = REG_SZ
        .Value = strGTA2MapDesc
    End With
    
    'check if the game is already in the list
    For intDupeNo = 1 To lvGames(0).ListItems.count
        If strNick = lvGames(0).ListItems.Item(intDupeNo) Then
            blnDuplicateFound = True
            Exit For
        End If
    Next
    
    If strGTA2MapDesc = vbNullString Then 'if the map desc is empty then no point hosting
        Exit Sub
    End If
    
    'search lvMMPlist for map description to get the corresponding MMP file
    For i = 1 To lvMMPlist.ListItems.count
        If LCase(lvMMPlist.ListItems.Item(i).ListSubItems(4).Text) = LCase(strGTA2MapDesc) Then
            strGTA2MMP = lvMMPlist.ListItems.Item(i).Text
            strMapFile = lvMMPlist.ListItems.Item(i).ListSubItems(1).Text
            strStyleFile = lvMMPlist.ListItems.Item(i).ListSubItems(2).Text
            strScriptFile = lvMMPlist.ListItems.Item(i).ListSubItems(3).Text
            strGTA2MapDesc = lvMMPlist.ListItems.Item(i).ListSubItems(4).Text
            intPlayerCount = Val(lvMMPlist.ListItems.Item(i).ListSubItems(5).Text)
            If intPlayerCount = 0 Then intPlayerCount = 6
            Exit For
        End If
    Next i
    
    If strGTA2MMP = vbNullString Then
        displaychat strChannel, strGHColor, "Failed to find an MMP file containing " & strGTA2MapDesc
        strGTA2MapDesc = vbNullString
        Exit Sub
    End If
    
    If blnDuplicateFound = True Then 'You already advertised your game
        'Check if you changed any settings from last time
        'I tried doing a With lvGames(0).ListItems.Item(i) here but the if statement didn't like it

        If lvGames(0).ListItems.Item(intDupeNo).ListSubItems.Item(1) = strPasswordProtectGame And _
        lvGames(0).ListItems.Item(intDupeNo).ListSubItems.Item(2) = Right$(strCountries(intCountryIndex), 2) And _
        lvGames(0).ListItems.Item(intDupeNo).SmallIcon = intCountryIndex + 1 And _
        lvGames(0).ListItems.Item(intDupeNo).ListSubItems.Item(3) = strGTA2MapDesc And _
        lvGames(0).ListItems.Item(intDupeNo).ListSubItems.Item(3).ToolTipText = strGTA2MMP And _
        lvGames(0).ListItems.Item(intDupeNo).ListSubItems.Item(4) = TXT_GHVER Then Exit Sub
        'You didn't change anything, abort!

        'You changed a setting on your hosted game...
        With lvGames(0).ListItems.Item(intDupeNo)
            .SmallIcon = intCountryIndex + 1
            .ToolTipText = Left$(strCountries(intCountryIndex), Len(strCountries(intCountryIndex)) - 5)
            With .ListSubItems
                .Item(1) = strPasswordProtectGame 'Yes or No
                .Item(2) = Right$(strCountries(intCountryIndex), 2) 'CC change
                .Item(2).ToolTipText = lvGames(0).ListItems.Item(intDupeNo).ToolTipText
                .Item(3) = strGTA2MapDesc
                .Item(3).ToolTipText = strGTA2MMP
                .Item(4) = TXT_GHVER
                If blnPlayReplay = True Then
                    strPlayReplay = "Play Replay"
                End If
                .Item(4).ToolTipText = strPlayReplay
                '.Item(5) = strGTA2version
            End With
        End With
    Else
        With lvGames(0).ListItems.Add(, , strNick, , intCountryIndex + 1)
            .ToolTipText = Left$(strCountries(intCountryIndex), Len(strCountries(intCountryIndex)) - 5)
            .ListSubItems.Add , , strPasswordProtectGame 'Yes or No
            .ListSubItems.Add , , Right$(strCountries(intCountryIndex), 2), , _
              Left$(strCountries(intCountryIndex), Len(strCountries(intCountryIndex)) - 5)
            .ListSubItems.Add , , strGTA2MapDesc, , strGTA2MMP
            .ListSubItems.Add , , TXT_GHVER
            '.ListSubItems.Add , , strGTA2version
        End With
    End If
    
    If strPreviousMapFile <> strMapFile Then
        strPreviousMapFile = strMapFile
        strMapChecksum = calc_crc32(strGTA2path & "data\" & strMapFile)
    End If
    
    If strPreviousScriptFile <> strScriptFile Then
        strPreviousScriptFile = strScriptFile
        strScriptChecksum = calc_crc32(strGTA2path & "data\" & strScriptFile)
    End If
    
    If blnCalculatedGTA2checksum = False Then
        strExecutableChecksum = calc_crc32(strGTA2path & TXT_GTA2EXE)
        blnCalculatedGTA2checksum = True
    End If
    
    'send game to channel
    Dim strAdvertisement As String
    Dim strGameOptions As String
    Dim strLocked As String
    If strPasswordProtectGame = "Yes" Then strLocked = "P"
    If blnPlayReplay = True Then strPlayReplay = "R"
    
    If strPlayReplay & strLocked <> vbNullString Then
        strGameOptions = "/" & strPlayReplay & strLocked
    End If
                
    'strAdvertisement = "G" & strCountryCode & strPlayReplay & strLocked & _
    ' "/" & strGTA2MMP & "/" & TXT_GHVER & "/" & strGTA2version
    
    strAdvertisement = "G" & strGTA2MMP & strGameOptions
    send "NOTICE " & strChannel & " :" & strAdvertisement
    
    Exit Sub
oops:
    strErrdesc = Err.Description
    strErrLine = Erl
    displaychat strDestTab, vbRed, "Error during advertise hosted game: " & strErrdesc
    send "PRIVMSG " & gta2ghbot & " :Error during advertise hosted game: " & strErrdesc & " Line: " & strErrLine
End Sub

Public Sub AddDescriptionAndFileToListView()
    On Error GoTo oops
    Dim strGTA2MapFileName As String
    Dim strMMPfullpath As String
    Dim NoPlayerCountMapsArray As New cSortArray
    Dim i As Long
    Dim j As Long
    Dim blnRefresh As Boolean
    Dim strRemoved(3) As String
    
    'add the filenames to a ListView for searching through later
    frmGH.lvMMPlist.ListItems.Clear
    If frmGH.lvMMPlist.ColumnHeaders.count = 0 Then
        frmGH.lvMMPlist.ColumnHeaders.Add(, , "MMP filename", 3500).Tag = "STRING"
        frmGH.lvMMPlist.ColumnHeaders.Add(, , "GMP", 3500).Tag = "STRING"
        frmGH.lvMMPlist.ColumnHeaders.Add(, , "STY", 3500).Tag = "STRING"
        frmGH.lvMMPlist.ColumnHeaders.Add(, , "SCR", 3500).Tag = "STRING"
        frmGH.lvMMPlist.ColumnHeaders.Add(, , "Description", 3500).Tag = "STRING"
        frmGH.lvMMPlist.ColumnHeaders.Add(, , "PlayerCount", 3500).Tag = "STRING"
    End If
    frmGH.lvMMPlist.View = lvwReport

    'Add the MMP filename and description to frmGH.lvMMPlist
    strGTA2MapFileName = Dir(strGTA2path & "data\*.mmp", vbHidden + vbNormal + vbSystem + vbReadOnly + vbArchive)
    Do While strGTA2MapFileName <> vbNullString
        strMMPfullpath = strGTA2path & "data\" & strGTA2MapFileName
        With frmGH.lvMMPlist.ListItems.Add(, , Left$(strGTA2MapFileName, Len(strGTA2MapFileName) - 4))
            Dim strGMP As String
            Dim strSCR As String
            Dim strSTY As String
            Dim strDescription As String
            Dim strPlayerCount As String
            strGMP = readINI("MapFiles", "GMPFile", strMMPfullpath)
            strSTY = readINI("MapFiles", "STYFile", strMMPfullpath)
            strSCR = readINI("MapFiles", "SCRFile", strMMPfullpath)
            strDescription = readINI("MapFiles", "Description", strMMPfullpath)
            strPlayerCount = readINI("MapFiles", "PlayerCount", strMMPfullpath)
            .ListSubItems.Add , , strGMP
            .ListSubItems.Add , , strSTY
            .ListSubItems.Add , , strSCR
            .ListSubItems.Add , , strDescription
            .ListSubItems.Add , , strPlayerCount
            If strPlayerCount = vbNullString Then NoPlayerCountMapsArray.AddItem (strGMP & strSTY & strSCR)
        End With
        
        strGTA2MapFileName = Dir
    Loop
    
    'Remove from list and erase any MMP files that point to GMP, STY or SCR files that don't exist
    For i = 1 To lvMMPlist.ListItems.count

        With lvMMPlist.ListItems(i)
            Erase strRemoved
            
            If Exists(strGTA2path & "data\" & .ListSubItems(1)) = False Then
                strRemoved(0) = .ListSubItems(1) & " "
            End If

            If Exists(strGTA2path & "data\" & .ListSubItems(2)) = False Then
                strRemoved(1) = .ListSubItems(2) & " "
            End If

            If Exists(strGTA2path & "data\" & .ListSubItems(3)) = False Then
                strRemoved(2) = .ListSubItems(3)
            End If

            strRemoved(3) = strRemoved(0) & strRemoved(1) & strRemoved(2)

            If strRemoved(3) <> vbNullString Then
                If modFileKill(strGTA2path & "data\" & lvMMPlist.ListItems(i).Text & ".mmp") = True Then
                    displaychat strChannel, strGHColor, "Removed " & lvMMPlist.ListItems(i).Text & ".mmp because " _
                    & strRemoved(3) & " doesn't exist"
                    blnRefresh = True
                End If
            End If
            
            'Rename obsolete MMP files
            For j = 1 To NoPlayerCountMapsArray.count - 1
            With lvMMPlist.ListItems(i)
                If .SubItems(5) <> vbNullString Then
                    If LCase$(.SubItems(1) & .SubItems(2) & .SubItems(3)) = _
                    LCase$(NoPlayerCountMapsArray.Item(j)) Then
                        If modFileKill(strGTA2path & "data\" & .Text & ".mmp") Then
                            displaychat strChannel, strGHColor, "Obsolete file removed: " & .Text & ".mmp"
                            blnRefresh = True
                        End If
                    End If
                End If
            End With
        Next j
        End With
    Next
 
    If blnRefresh = True Then Call PreHost
    
Exit Sub
oops:
    strErrdesc = Err.Description
    strErrLine = Erl
    displaychat strDestTab, strTextColor, "error during AddDescriptionAndFileToListView: " & strErrLine & " " & strErrdesc
    send "PRIVMSG " & gta2ghbot & " :AddDescription: " & strErrLine & " " & strErrdesc
End Sub

Private Sub form_KeyDown(KeyCode As Integer, Shift As Integer)
'Key Code Constants: http://msdn.microsoft.com/en-us/library/aa243025(VS.60).aspx
Dim i As Integer

Select Case KeyCode
Case vbKeyF 'ctrl+f
    If Shift = vbCtrlMask Then Call findReplace
Case vbKeyF2
    'Call download
    'Clear the contents of rtb1
        rtbHistory(0).Text = ""
    'Clear the clipboard
        Clipboard.Clear
    'Populate the clipboard with image 1's picture
        Clipboard.SetData imgBanner.Picture
    'Add it to rtb1
        SendMessage rtbHistory(0).hwnd, WM_PASTE, 0, 0

Case vbKeyW, vbKeyF4
    If Shift = vbCtrlMask Then 'Ctrl+W: 'close tab
        If tabIRC.Tabs.count < 2 Then Exit Sub
        
        'close all tabs
        If KeyCode = vbKeyF4 Then
            KeyCode = 0
            
            For i = 1 To rtbHistory.UBound
                Unload rtbHistory(i)
                Unload rtbChatbox(i)
                Unload rtbTopic(i)
            Next
            
            If lvPlayers.UBound > 0 Then
                For i = 1 To lvPlayers.UBound
                    Unload lvPlayers(i)
                Next
            End If
            
            For i = 2 To tabIRC.Tabs.count
                If Left$(tabIRC.Tabs(i).Caption, 1) = "#" Then send "PART " & tabIRC.Tabs(i).Caption
            Next
            
            tabIRC.Tabs.Clear
            tabIRC.Tabs.Add , , strChannel
            
            Call switchTabLeft
            
            Exit Sub
        End If
        
        KeyCode = 0
        
        'Close selected tab
        If tabIRC.SelectedItem.Index = 1 Then Exit Sub
        
        Dim strTab As String
        strTab = tabIRC.SelectedItem.Caption
        
        For i = 1 To rtbHistory.UBound
            If LCase(rtbHistory(i).Tag) = LCase(strTab) Then
                rtbHistory(i).Visible = False
                rtbChatbox(i).Visible = False
                rtbTopic(i).Visible = False
            End If
        Next

        If Left$(strTab, 1) = "#" Then
            send "PART " & strTab
            For i = 0 To lvPlayers.UBound
                If LCase(lvPlayers(i).Tag) = LCase(strTab) Then
                    lvPlayers(i).Visible = False
                End If
            Next
        End If
        
        tabIRC.Tabs.Remove tabIRC.SelectedItem.Index
        Call switchTabLeft
        
    End If
'switch to tab n when alt + n or ctrl + n are pushed
Case vbKey1, vbKey2, vbKey3, vbKey4, vbKey5, vbKey6, vbKey7, vbKey8, vbKey9
    If Shift = vbAltMask Or Shift = vbCtrlMask Then
        Dim intkeyCode As Integer
        intkeyCode = KeyCode
        KeyCode = 0
        If Chr$(intkeyCode) <= tabIRC.Tabs.count Then
            tabIRC.Tabs.Item(Val(Chr$(intkeyCode))).Selected = True
        End If
    End If
Case vbKeyTab
    KeyCode = 0
    If Shift = 3 Then ' 3 = ctrl+shift
        'ctrl+shift+tab to move to the tab on the left
        Call switchTabLeft
    End If

    If Shift = vbCtrlMask Then
        'ctrl+tab to move to the tab on the right
        Call switchTabRight
    End If
    
Case vbKeyLeft
    If Shift = vbAltMask Then Call switchTabLeft
Case vbKeyRight
    If Shift = vbAltMask Then Call switchTabRight
End Select
End Sub

Private Sub switchTabLeft()
    If tabIRC.SelectedItem.Index = 1 Then
        tabIRC.Tabs.Item(tabIRC.Tabs.count).Selected = True
    Else
        tabIRC.Tabs.Item(tabIRC.SelectedItem.Index - 1).Selected = True
    End If
End Sub

Private Sub switchTabRight()
    If tabIRC.SelectedItem.Index = tabIRC.Tabs.count Then
        tabIRC.Tabs(1).Selected = True
    Else
        tabIRC.Tabs.Item(tabIRC.SelectedItem.Index + 1).Selected = True
    End If
End Sub

Private Function calc_crc32(ByVal strFile As String) As String
On Error GoTo oops
    Dim cStream As New cBinaryFileStream
    Dim cCRC32 As New cCRC32
    cStream.File = strFile
    lCRC32 = cCRC32.GetFileCrc32(cStream)
    calc_crc32 = Pad_String(Hex(lCRC32), 8, "0")

Exit Function
oops:
    strErrdesc = Err.Description
    strErrLine = Erl
    displaychat strDestTab, vbRed, "Error during calc_crc32: " & strErrdesc & " - Line: " & strErrLine
    send "PRIVMSG " & gta2ghbot & " :Error during calc_crc32: " & strErrdesc & " Line: " & strErrLine
End Function

Public Function Pad_String(work As String, ReqLength As Long, padChar As String) As String
    On Error GoTo oops:
    Pad_String = String$(ReqLength - Len(work), padChar) & work
    Exit Function
oops:
    strErrdesc = Err.Description
    strErrLine = Erl
    displaychat strDestTab, vbRed, "Error during padstring: " & strErrdesc & " - Line: " & strErrLine
    send "PRIVMSG " & gta2ghbot & " :Error during padstring: " & strErrdesc & " Line: " & strErrLine
End Function

'Sign In
Public Sub cmdConnect_click()
On Error GoTo oops

'Dim a As New Download.File
'a.CopyURLToFile ("http://gtamp.com/maps/bff-wipeout.7z")
'Set a = Nothing

    Dim i As Integer
    
'   displaychat strChannel, strGHColor, "Latest GH version: " & CopyURLToRAM("http://gtamp.com/version.txt")
    
    lvGames(0).ListItems.Clear
    
'    If blnConnected = True Then
'        send "JOIN " & strChannel & " " & strKey
'
'        If tabIRC.Tabs.count > 1 Then
'            For i = 1 To tabIRC.Tabs.count
'                send "JOIN " & tabIRC.Tabs(i).Caption
'            Next i
'        End If
        cmdConnect.Enabled = False
        mnuFileSignIn.Enabled = False
        cmdDisconnect.Enabled = True
        mnuFileSignOut.Enabled = True
'        Exit Sub
'    End If
    
    With cR
        .ClassKey = HKEY_CURRENT_USER
        .SectionKey = "SOFTWARE\GTA2 Game Hunter"
        .ValueKey = "ExternalHostName"
        If strCountryCode = vbNullString Or .Value = vbNullString Then
            blnGotCC = True
            Call getCC
        Else
            blnGotCC = False
        End If
    End With
    
    blnLogin = False
    If strStatusMsg = "=HW" Then strStatusMsg = vbNullString
    strFailedCountryIP = vbNullString
    If strPreferedNick = vbNullString Or Left$(strNick, 3) = "Ped" Or Left$(strNick, 5) = "Guest" Then
        displaychat strDestTab, vbRed, "Set an IRC name and GTA2 name. Press F4 to open the settings screen."
        Exit Sub
    End If
    
    If strPassword = vbNullString Then
        displaychat strDestTab, vbRed, "You must set a password. Press F4 to open the settings screen."
        Exit Sub
    End If
    
    sockIRC.Close
    strKey = "Pac-Man"
    strPort = "8067"
    strDestTab = strChannel
    intNickservWaitTime = 0
    blnConnectClick = True
    Call MoveMMPfiles 'moves MMP files from tempMMP to data and then removes tempMMP folder
    
    Call DetectGTA2version
    
    timTimeout.Enabled = True
    displaychat strDestTab, strConnectionColor, "Connecting to: " & strServer(0) & " port " & strPort
    'sockIRC.Connect Left$(strServer(intServerNum), InStr(strServer(intServerNum) & " ", " ") - 1), strPort 'connect to the server
    sockIRC.Connect Left$(strServer(intServerNum), InStr(strServer(0) & " ", " ") - 1), strPort 'connect to the server
    Exit Sub
    
oops:
  strErrLine = Erl
  If Err.Description = "Path not found" Then
      displaychat strDestTab, vbRed, "GTA2 folder was not found!"
      cmdConnect.Enabled = True
      mnuFileSignIn.Enabled = True
  Else
      displaychat strDestTab, vbRed, "Error connecting: " & Err.Description & " Line: " & strErrLine
      cmdConnect.Enabled = True
      mnuFileSignIn.Enabled = True
  End If
End Sub

Public Sub cmdOptions_Click()
    If frmOptions.Visible = False Then Call frmOptions.loadSettings
    frmOptions.Show
End Sub

Private Sub cmdGTA2Manager_Click()
    On Error GoTo oops
    Dim strGTA2Manager As String
    strGTA2Manager = "gta2manager.exe"
    If Exists(strGTA2path & strGTA2Manager) = False Then
        strGTA2Manager = "gta2 manager.exe"
    End If
    AppActivate "GTA2 Manager"
    Exit Sub
oops:
    If Exists(strGTA2path & strGTA2Manager) = True Then
        'Call ShellExecute(Me.hwnd, "Open", , vbNullString, strGTA2path, vbNormalFocus)
        Call shellandwait(vbQuote & strGTA2path & strGTA2Manager & vbQuote, strGTA2path)
    Else
        displaychat strDestTab, vbRed, "Can't find " & strGTA2path & strGTA2Manager
    End If
End Sub

Private Sub mnuFileCreateGame_Click()
    cmdHost_Click
End Sub

Private Sub mnuFileSignIn_Click()
    cmdConnect_click
End Sub

Private Sub mnuFileSignOut_Click()
    cmdDisconnect_Click
End Sub

Private Sub mnuFileTray_Click()
    Systray
    Hide
End Sub

Private Sub mnuHelpChangelog_Click()
    Call launch("changelog.txt")
End Sub

Private Sub mnuHelpGTA2GH_Click()
    Call launch("readme.txt")
End Sub

Private Sub mnuHelpTodo_Click()
    Call launch("todo.txt")
End Sub

Private Sub launch(strFile As String)
On Error GoTo oops
    If Exists(App.Path & "\" & strFile) = True Then
        Call ShellExecute(Me.hwnd, "Open", App.Path & "\" & strFile, vbNullString, App.Path, vbMaximizedFocus)
    Else
        displaychat strDestTab, strGHColor, App.Path & "\" & strFile & " is missing"
    End If
    
    Exit Sub
oops:
    strErrdesc = Err.Description
    displaychat strDestTab, strTextColor, "Failed to open  " & strFile & " - " & strErrdesc
End Sub
Private Sub mnuToolsOptions_Click()
    cmdOptions_Click
End Sub

Private Sub mnuViewBMTheme_Click()
    intTheme = 1
    mnuViewBMTheme.Checked = True
    mnuViewGTA2Theme.Checked = False
    mnuViewClassicTheme.Checked = False
    strTextColor = &H80000008  'Window Text
    strJoinColor = 32768   'green
    strQuitColor = 8388608 'blue
    strForeColor = &H80000008  'Window Text
    strBackColor = &H80000005 'Window Background
    strFontName = "Arial"
    strFontSize = 10
    blnFontBold = False
    blnFontItalic = False
    lvGames(0).Font = "Microsoft Sans Serif"
    lvGames(0).Font.Size = 8
    lvGames(0).Font.Bold = False
    lvGames(0).Font.Italic = False
    lvGames(0).ForeColor = strForeColor
    lvGames(0).BackColor = strBackColor
    
    frmGH.BackColor = &H8000000F
    Call applyFormat
End Sub

Private Sub mnuViewGTA2Theme_Click()
    intTheme = 2
    mnuViewGTA2Theme.Checked = True
    mnuViewBMTheme.Checked = False
    mnuViewClassicTheme.Checked = False
    strTextColor = 12632256 'silver
    strJoinColor = 32768    'green
    strQuitColor = 32768    'green
    strForeColor = strTextColor
    strBackColor = vbBlack
    strFontName = "FixedSys"
    strFontSize = 9
    blnFontBold = False
    blnFontItalic = False
    lvGames(0).Font = "Microsoft Sans Serif"
    lvGames(0).Font.Size = 8
    lvGames(0).Font.Bold = False
    lvGames(0).Font.Italic = False
    lvGames(0).ForeColor = strForeColor
    lvGames(0).BackColor = strBackColor
    
    lvGames(0).Appearance = ccFlat
    lvPlayers(0).Appearance = ccFlat
    'rtbTopic(0).Appearance = rtfFlat
    'rtbHistory(0).Appearance = rtfFlat
    'rtbChatBox(0).Appearance = rtfFlat
    frmGH.BackColor = vbBlack
    Call applyFormat
End Sub

Private Sub mnuViewClassicTheme_Click()
    intTheme = 3
    mnuViewClassicTheme.Checked = True
    mnuViewGTA2Theme.Checked = False
    mnuViewBMTheme.Checked = False
    strTextColor = &H80000008  'Window Text
    strJoinColor = 32768   'green
    strQuitColor = 8388608 'blue
    strForeColor = &H80000008  'Window Text
    'strBackColor = &H80000005 'Window Background
    strBackColor = 15658734 'mIRC's Placid Hues theme grey
    strFontName = "FixedSys"
    strFontSize = 9
    blnFontBold = False
    blnFontItalic = False
    lvGames(0).Font = "Microsoft Sans Serif"
    lvGames(0).Font.Size = 8
    lvGames(0).Font.Bold = False
    lvGames(0).Font.Italic = False
    lvGames(0).ForeColor = strForeColor
    lvGames(0).BackColor = strBackColor
    
    frmGH.BackColor = &H8000000F
    Call applyFormat
End Sub
    
Private Sub applyFormat()
On Error GoTo oops

    Dim i As Integer
    Dim lngSelPos As Long
    
    'ListViews match each other:
    For i = 0 To lvPlayers.UBound
        lvPlayers(i).Font = lvGames(0).Font
        lvPlayers(i).Font.Size = lvGames(0).Font.Size
        lvPlayers(i).Font.Bold = lvGames(0).Font.Bold
        lvPlayers(i).Font.Italic = lvGames(0).Font.Italic
        lvPlayers(i).ForeColor = lvGames(0).ForeColor
        lvPlayers(i).BackColor = lvGames(0).BackColor
    Next
    
    For i = 0 To rtbChatbox.UBound

        With rtbHistory(i)
           lngSelPos = .SelStart
          .BackColor = strBackColor
          .Font = strFontName
          .Font.Size = strFontSize
          .Font.Bold = blnFontBold
          .Font.Italic = blnFontItalic
          .SelStart = 0
          .SelLength = Len(.Text)
          .SelColor = strForeColor
          .SelBold = blnFontBold
          .SelItalic = blnFontItalic
          .SelFontName = strFontName
          .SelFontSize = strFontSize
          .SelLength = 0
          .SelStart = lngSelPos
        End With
    
        With rtbChatbox(i)
            lngSelPos = .SelStart
            .BackColor = strBackColor
            .Font = strFontName
            .Font.Size = strFontSize
            .Font.Bold = blnFontBold
            .Font.Italic = blnFontItalic
            .SelStart = 0
            .SelLength = Len(.Text)
            .SelColor = strForeColor
            .SelBold = blnFontBold
            .SelItalic = blnFontItalic
            .SelFontName = strFontName
            .SelFontSize = strFontSize
            .SelLength = 0
            .SelStart = lngSelPos
        End With
    
        With rtbTopic(i)
            lngSelPos = .SelStart
            .BackColor = strBackColor
            .Font = strFontName
            .Font.Size = strFontSize
            .Font.Bold = blnFontBold
            .Font.Italic = blnFontItalic
            .SelStart = 0
            .SelLength = Len(.Text)
            .SelColor = strForeColor
            .SelBold = blnFontBold
            .SelItalic = blnFontItalic
            .SelFontName = strFontName
            .SelFontSize = strFontSize
            .SelLength = 0
            .SelStart = lngSelPos
            .TextRTF = .TextRTF
        End With
    
    Next i
    
    Call Form_Resize
    
    rtbTopic(0).SelRTF = rtbTopic(0).SelRTF
    Exit Sub
oops:
 strErrLine = Erl
 strErrdesc = Err.Description
 displaychat strDestTab, strTextColor, "Error applying format: " & strErrdesc & ", Line: " & strErrLine
 send "PRIVMSG " & gta2ghbot & " :ApplyFormat " & strErrdesc & " " & strErrLine
End Sub

Private Sub mnuToolsGTA2manager_Click()
    cmdGTA2Manager_Click
End Sub

'if the systray icon is clicked then show the form
Private Sub picTray_mouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
    If Button = 1 Then
        blnSystray = False
        WindowState = intPrevWinState
        Show
        If blnchkTray = False Then
            RemoveSystray
        Else
            frmGH.picTray.Picture = Me.Icon
            Call drawTrayIcon
        End If
    End If
End Sub

'remove systray
Private Sub RemoveSystray()
    Shell_NotifyIcon NIM_DELETE, TaskIcon
End Sub

Private Sub Form_Unload(Cancel As Integer)
    On Error GoTo oops
    'hide form if close to tray is ticked
    If blnchkCloseTray = True Then
        Cancel = 1
        Hide
        Call Systray
    Else
        cmdExit_Click
    End If

    Exit Sub
oops:
  strErrdesc = Err.Description
  displaychat strDestTab, strTextColor, strErrdesc
  Select Case MsgBox("Are you sure you want to quit?", vbYesNo Or vbExclamation Or vbDefaultButton1, App.Title)
      Case vbYes
          cmdExit_Click
  End Select
End Sub

Private Sub mnuToolsSize_Click(Index As Integer)
'''Set window to common sizes for screenshots.

'Variables:
Dim lngWidth As Long, lngHeight As Long

WindowState = vbNormal
Select Case Index
    Case 0
        lngWidth = 640
        lngHeight = 480
    Case 1
        lngWidth = 800
        lngHeight = 600
    Case 2
        lngWidth = 1024
        lngHeight = 768
    Case 3
        lngWidth = 1280
        lngHeight = 960
End Select

'Convert from px to twip:
lngWidth = lngWidth * Screen.TwipsPerPixelX
lngHeight = lngHeight * Screen.TwipsPerPixelY

'Apply new size:
Move Left, Top, lngWidth, lngHeight

End Sub

'****************************************************************
' lvGH_ColumnClick
' Called when a column header is clicked on - sorts the data in
' that column
'----------------------------------------------------------------
Private Sub lvGames_ColumnClick(Index As Integer, ByVal ColumnHeader As _
                                    MSComctlLib.ColumnHeader)
    Call SortLV(frmGH.lvGames(Index), ColumnHeader)
End Sub

Private Sub lvPlayers_ColumnClick(Index As Integer, ByVal ColumnHeader As _
                                    MSComctlLib.ColumnHeader)
    Dim i As Integer
    For i = 0 To lvPlayers.UBound
        Call SortLV(frmGH.lvPlayers(i), ColumnHeader)
    Next i
End Sub


Private Sub loadViewSettings()
On Error GoTo oops
   Dim i As Integer
   With cR
        .ClassKey = HKEY_CURRENT_USER
        .SectionKey = "SOFTWARE\GTA2 Game Hunter"
        .ValueKey = "chkTimestamp"
        blnchkTime = .Value
        
        frmGH.mnuViewTimestamp.Checked = blnchkTime
        
        .ValueKey = "Gridlines"
        frmGH.mnuViewGridlines.Checked = .Value
        frmGH.lvGames(0).GridLines = frmGH.mnuViewGridlines.Checked
        For i = 0 To frmGH.lvPlayers.UBound
            frmGH.lvPlayers(i).GridLines = frmGH.mnuViewGridlines.Checked
        Next
    End With
    Exit Sub
oops:
  strErrdesc = Err.Description
  displaychat strChannel, vbRed, "Error loading theme settings: " & strErrdesc
End Sub

Public Sub changeStatus(ByVal strStatus As String, Optional strName As String)

'Find a player in the player list and set their status
'If the player is you then also change strStatusMsg
 
If strName = vbNullString Then
    strName = strNick
    
    Select Case strStatus
        Case "A"
            strStatusMsg = "A"
            strStatus = "Away"
        Case "2"
            strStatusMsg = "2"
            strStatus = "GTA2"
        Case Else
            strStatusMsg = strStatus
    End Select
End If

strStatus = Replace(strStatus, "=", vbNullString)

Dim i As Integer
Dim itmX As ListItem

For i = 0 To lvPlayers.UBound
    Set itmX = frmGH.lvPlayers(i).FindItem(strName, lvwText)
    If Not itmX Is Nothing Then
        frmGH.lvPlayers(i).ListItems.Item(itmX.Index).ListSubItems(2) = strStatus
    End If
Next i

ShowListViewColumnHeaderSortIcon frmGH.lvPlayers(0)
Call SortColumn(frmGH.lvPlayers(0), frmGH.lvPlayers(0).SortKey + 1)

End Sub

Private Sub back()
    strStatusMsg = vbNullString
    send "AWAY"
    send "NOTICE " & strChannel & " :S"
End Sub

Private Sub toggleAwayStatus(Optional ByVal strAwayMessage As String)
    If strStatusMsg = "A" Then
        Call back
    Else
        strStatusMsg = "A"
        strAwayMsg = strAwayMessage
        send "AWAY :" & strAwayMsg
        send "NOTICE " & strChannel & " SA"
    End If
    
    Call changeStatus(strStatusMsg)
End Sub

Private Sub hideWindows()
Dim i As Integer
For i = 0 To rtbHistory.UBound
    If rtbTopic(i).Visible = True Then rtbTopic(i).Visible = False
    If rtbHistory(i).Visible = True Then rtbHistory(i).Visible = False
    If rtbChatbox(i).Visible = True Then rtbChatbox(i).Visible = False
Next i
End Sub

Private Sub saveChannels()
'On Error Resume Next

Dim strChannels As String
Dim i As Integer

For i = 1 To frmGH.tabIRC.Tabs.count
    If Left$(frmGH.tabIRC.Tabs(i).Caption, 1) = "#" Then
        strChannels = strChannels & frmGH.tabIRC.Tabs(i)
    End If
Next

With cR
    .ClassKey = HKEY_CURRENT_USER
    .SectionKey = "SOFTWARE\GTA2 Game Hunter"
    .ValueType = REG_SZ
    .ValueKey = "Channels"
    .Value = strChannels
End With
                
End Sub

Private Sub unpnp_Click()
    Dim strUnPnPpath As String
    strUnPnPpath = "extras\unpnp.exe"
    Call CopyURLToFile("http://www.grc.com/files/unpnp.exe", strGTA2path & strUnPnPpath)
    'AppActivate "UnPlug n' Pray - Manage UPnP Now!" 'error
    If Exists(strGTA2path & strUnPnPpath) = True Then 'doesnt wait for download to finish yet
        Call shellandwait(vbQuote & strGTA2path & strUnPnPpath & vbQuote, strUnPnPpath)
        MsgBox (strGTA2path & strUnPnPpath)
    End If
End Sub

Private Sub download()
'Call CopyURLToFile("gtamp.com", "/maps/pza.7z")
'Call CopyURLToFile("gtamp.com", "/maps/bff-wipeout.7z")
Call CopyURLToFile("http://gtamp.com/maps/bff-wipeout.7z", GetTmpPath & "gta2map.7z")
End Sub

Private Sub findReplace()
    Dim strText As String
    strText = InputBox(vbQuote, vbQuote)
    
    MsgBox rtbHistory(tabIRC.SelectedItem.Index).Find(strText)
      
    'rtbHistory(0).hwnd
End Sub

Private Function SetMouseCursor(CursorType As Long)
  Dim hCursor As Long
  hCursor = LoadCursorLong(0&, CursorType)
  hCursor = SetCursor(hCursor)
End Function
